Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Makefile [ 4 0 points ] Write a Makefile that builds the executable object test - map, map - cli, and the library libmap.a .
Makefile points
Write a Makefile that builds the executable object testmap, mapcli, and the library
libmap.a The executable objects testmap and mapcli are created by linking the library
libmap.a and the object file testmap.o mapcli.o respectively To build the library
libmap.a you should use the ar utility to archive the object files mapmodify.o and
maputil.o
As discussed in class, the following should apply to your Makefile to receive full credit:
The Makefile should contain the all and clean targets,
the proper compiler flags CFLAGS and preprocessor flags CPPFLAGS should be used,
each C source file should be compiled separately into the corresponding object file
using the c option with gcc
static libraries must be created using the ar utility,
object files, libraries, and executable objects should be placed in their respective loca
tions based on the directory structure discussed in class, and
symbolic links should be created for the executable objects testmap and mapcli at
the root of the project same location where the Makefile exists
Creating a header file points
Write a header file map.h for the provided C file map.c As discussed in class, the header
file must contain the following:
Prototypes for all map functions,
all relevant type definitions,
all relevant macros, and
include guard.
Implementing the functionality points
Using the provided file map.c you are going to split the file into C files containing the
following functions. Each of the C files must #include the header file map.h you created.
a mapmodify.c
map add
map remove
map clear can also be used to initialize a new map
b maputil.c
map find
map size
map print
c mapcli.c
main
Testing points
In this part, you will test your libmap. But we will use both a unittest approach and an
endtoend approach.
Unittests
First you will create multiple unittest functions of the following functions:
map add tests
map remove tests
map clear test
map find tests
map size tests
Each of these functions total should initialize data it needs and preform a single test
action. ie inserting to an empty list, as well as programmatically validate the result,
returning on success, and on failure. Your unittests should not require outside verification
of your code.
In addition, you should create a main function which runs all of these tests printing their
name and result. The main function should return only if all tests are successful.
endtoend
You will construct testcases which test a more complete set combine different behaviours
together of functionality. These tests are comprised of a short description what the test
case is supposed to test and why input data stdin input expected stdout output, the
actual output from the program.
To make your tests usable you will break this into file that summarizes all the tests
maptesting.txt then each test will have a pair of files:
testxintxt that contains the stdin
testxout.txt that contains the expected stdout output from the program
To run a test, you can use the following command all of the following must be on a single
line when you type it into the terminal:
test $ diff wB map cli test x in txt cat test x out txt wc l
&& echo PASS echo FAIL
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started