Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Starter code The starter code for this assignment can be found under / student / cmpt 2 1 4 / 2 0 2 4 /
Starter code The starter code for this assignment can be found under studentcmptsummerstartera: list.c testlist.c this file is not to be modified Question points Write a header file list.h for the provided C file list.c As discussed in class, the header file must contain the following: Prototypes for all noninternal list function, all relevant type definitions, all relevant macros, and include guard. Write an internal header file list internal.h which provides: Prototypes and for internal functions, all relevant type definitions, all relevant macros, and include guard. Question points Using the provided file list.c you are going to split the file into C files containing the fol lowing functions. Each of the C files must #include the headers list.h and list internal.h you created in Question a listinit.c list init b listadder.c list prepend list append list insert before list insert after c listremove.c list pop list remove list clear d listprocess.c list find e listutil.c list print f listinternal.c list internal prepend list internal pop list internal before list internal find tail Question points Write a Makefile that builds three executable objects testliststatic, testlistdynamic, and listcli. The executable object testliststatic is created by linking the static li brary liblist.a and the object file testlist.o The executable object testlistdynamic is created by linking the dynamic library liblistdynamic.so and the object file testlist.o The executable object listcli is created by linking either liblist.a or liblistdynamic.so your choice to listcli.o To build the the static library liblist.a you should use the ar utility to archive the object files listinit.o listadder.o listremove.o listprocess.o listinternal.o and listutil.o into a static library. The executable object testlistdynamic is created by linking the dynamic library liblistdynamic.so and the object file testlist.o To build the the dynamic library liblistdynamic.so you should use gcc to combine the object files listinit.o listadder.o listremove.o listprocess.o listinternal.o and listutil.o into one shared object. 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, dynamic libraries must be created using gcc and the shared option, object files, libraries, and executable objects should be created in the proper directories depending on the type of system running the Makefile, and symbolic links should be created for the three executable objects testliststatic, testlistdynamic and listcli at the root of the project same location where the Makefile exists If everything works, you should be able to run the two executable files and see the message ALL TESTS PASSED Testing points In this part, you will test the list using an endtoend approach. testlist already provides a unittest approach 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 listtesting.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 list cli test x in txt cat test x out txt wc l && echo PASS echo FAIL
Starter code
The starter code for this assignment can be found under studentcmptsummerstartera:
list.c
testlist.c this file is not to be modified
Question points
Write a header file list.h for the provided C file list.c As discussed in class, the header
file must contain the following:
Prototypes for all noninternal list function,
all relevant type definitions,
all relevant macros, and
include guard.
Write an internal header file list internal.h which provides:
Prototypes and for internal functions,
all relevant type definitions,
all relevant macros, and
include guard.
Question points
Using the provided file list.c you are going to split the file into C files containing the fol
lowing functions. Each of the C files must #include the headers list.h and list internal.h
you created in Question
a listinit.c
list init
b listadder.c
list prepend
list append
list insert before
list insert after
c listremove.c
list pop
list remove
list clear
d listprocess.c
list find
e listutil.c
list print
f listinternal.c
list internal prepend
list internal pop
list internal before
list internal find tail
Question points
Write a Makefile that builds three executable objects testliststatic, testlistdynamic,
and listcli. The executable object testliststatic is created by linking the static li
brary liblist.a and the object file testlist.o The executable object testlistdynamic
is created by linking the dynamic library liblistdynamic.so and the object file testlist.o
The executable object listcli is created by linking either liblist.a or liblistdynamic.so
your choice to listcli.o
To build the the static library liblist.a you should use the ar utility to archive the object
files listinit.o listadder.o listremove.o listprocess.o listinternal.o
and listutil.o into a static library. The executable object testlistdynamic is created
by linking the dynamic library liblistdynamic.so and the object file testlist.o
To build the the dynamic library liblistdynamic.so you should use gcc to combine the
object files listinit.o listadder.o listremove.o listprocess.o listinternal.o
and listutil.o into one shared object.
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,
dynamic libraries must be created using gcc and the shared option,
object files, libraries, and executable objects should be created in the proper directories
depending on the type of system running the Makefile, and
symbolic links should be created for the three executable objects testliststatic,
testlistdynamic and listcli at the root of the project same location where the
Makefile exists
If everything works, you should be able to run the two executable files and see the message
ALL TESTS PASSED
Testing points
In this part, you will test the list using an endtoend approach. testlist already provides
a unittest approach
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
listtesting.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 list 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 with AI-Powered 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