Table of Contents

BACKGROUND

SPECIFICATIONS

This week we are working on the following functions:

The way in which you proceed through these functions only matter if you want to use functions inside other functions. Unit tests this week do not rely upon other functions created this week to work. Some unit tests will make use of functions made last week, for dll0. Make sure that your cplist works well because that is found commonly throughout the unit tests.

Some possible combinations to get you going: empty inside rmlist, obtain inside empty, swap inside sort. There are more combinations possible to reduce the amount of reinventing that your doing of the wheel, but these are a few to just get you started on the idea of combining functions inside other functions.

*Our task is to ask questions on Discord or in class and document our findings on this wiki page collaboratively, regarding the functionality of this project.

*For anybody interested in editing the wiki page, here is the dokuwiki user guide: https://www.dokuwiki.org/wiki:syntax#basic_text_formatting -Ash

PROGRAM

It should be noted that the new compare is quite similar to the sllx version, therefore drawing inspiration from the code one wrote previously may be of assistance.

For the new rmlist function, like the one in the previous sllx projects, it would be wise to work on the empty function first (similar to that of the clear function in the sllx projects). That way when you want to deallocate a list, you can call the empty function to clear up the nodes within the list to ensure there is no memory leak.

NOTE If you are trying to work on this project without a fully functional dll0 library, you are still able to complete this project, and get full credit (if new implementations pass all the test cases). To do this, in your root folder of dll1 type: make use-test-reference. Rather than using your implementations of previous functions, your make will now use working implementations ONLY of functions from previous dllX's.

OUTPUT SPECIFICATIONS

No output to stdout for any of these functions, all functions should modify the list in some way, shape, or form.

UNIT TESTS

Total of 162 tests. Unit tests are called with make check, similar to every other week. Safe practice to make clean before every make to ensure old results are cleaned up. There will be an errors file created after running make, it’s a good idea to check this as well. Tests are split amongst all the functions, with 7 going to empty and rmlist. Compare, Swap, Sort, and Obtain have 12, 31, 48, and 57 tests respectively. While unit tests do a good job of ensuring basic functionality, ensure that your functions can work with any provided input. To be specific, if you're going to use swap inside sort(a good idea), make sure your swap can handle functions side by side anywhere in the list. The unit test for swap does not check for this.

Additionally, if one wishes to be shown any compiling errors/warnings immediately, one could use “make debug” to do so, as this will reroute the contents of the make to stdout instead of the errors file.