This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
haas:spring2015:data:projects:sll3 [2015/03/10 12:16] – [Objective] wedge | haas:spring2015:data:projects:sll3 [2015/03/30 16:26] (current) – [List library unit tests] wedge | ||
---|---|---|---|
Line 11: | Line 11: | ||
This section will document any updates applied to the project since original release: | This section will document any updates applied to the project since original release: | ||
- | * __revision | + | * __revision |
+ | * verify-group.sh updated with correct values | ||
+ | * all that remains now is lappend, linsert, and lobtain... hopefully before too long. | ||
+ | * __revision 2__: unit tests for lappend and linsert released (20150322) | ||
+ | * verify-group.sh updated with correct totals | ||
+ | * unit-lobtain and unit-rmgroup are still in need of completion; I'll be extending the deadline yet again to compensate for this (but I will be releasing the next project this week as originally planned). | ||
+ | * the issue is really one of distraction: | ||
+ | * so, there will be at least one more revision, when it is ready, to bring in the lobtain and rmgroup unit tests (don't worry, dll0 will not depend on ANY of the code we've written so far). | ||
+ | * __revision 3__: unit-lsetpos wasn't actually completed (20150329) | ||
+ | * on one of the last tests, it was segfaulting. This has been FIXED. | ||
+ | * verify-group.sh updated with corrected unit-lsetpos test count. | ||
+ | * unit-lobtain and unit-rmgroup still to be finished. | ||
+ | * __revision 4__: unit-lobtain and unit-rmgroup released (20150330) | ||
+ | * unit-rmgroup was held up by a bug in my lobtain() implementation; | ||
+ | * unit-lobtain, | ||
=====Objective===== | =====Objective===== | ||
Line 19: | Line 34: | ||
=====Project Overview===== | =====Project Overview===== | ||
- | For this project, we're going to be implementing | + | ====list.h==== |
+ | For this project, we need to make a couple modifications | ||
<code c> | <code c> | ||
- | List *obtain (List *, Node **); | + | struct list { |
- | List *clearlist(List *); // empty an existing | + | |
- | List *rmlist(List *); | + | |
- | List *swapnode(List *, Node *, Node *); // swap positions | + | |
- | List *sortlist(List *, int); // sort list (according to mode) | + | |
+ | }; | ||
+ | typedef struct list | ||
</ | </ | ||
- | ====list library==== | + | Specifically, |
- | In **src/list/**, you will find 5 new C files: | + | |
+ | To implement **qty**, all list functions that perform manipulations to the list will need to see some updating (**insert()**, | ||
+ | |||
+ | **mklist()** should also set the list's **after** pointer to a sane initial state (NULL). | ||
+ | |||
+ | ====group.h==== | ||
+ | With the updated | ||
+ | |||
+ | <code c> | ||
+ | #ifndef _GROUP_H | ||
+ | #define _GROUP_H | ||
+ | |||
+ | #include " | ||
+ | |||
+ | struct groupoflists { | ||
+ | List *first; | ||
+ | List *last; | ||
+ | }; | ||
+ | typedef struct groupoflists Group; | ||
+ | |||
+ | Group *mkgroup(void); | ||
+ | Group *rmgroup(Group *); // clear/ | ||
+ | |||
+ | Group *linsert(Group *, List *, List *); // add list before given list | ||
+ | Group *lappend(Group *, List *, List *); // add list after given list | ||
+ | Group *lobtain(Group *, List **); // obtain/ | ||
+ | |||
+ | long int ldisplay(Group *, long int); // display entire/ | ||
+ | |||
+ | long int lgetpos(Group *, List *); // retrieve position from given node | ||
+ | List | ||
+ | |||
+ | #endif | ||
+ | </ | ||
+ | |||
+ | You should notice a striking similarity to the core list functionality (a first and a last pointer-- only to Lists, and not Nodes), and the presence of Group manipulation and utility functions (appending, inserting, obtaining, displaying, getting/ | ||
+ | |||
+ | This project will test the level of your abstraction skills-- for there isn't that much of a conceptual difference between the list functions and the group functions. The more you understand that, the easier this project will be. | ||
+ | ====group | ||
+ | In **src/group/**, you will find 7 new C files: | ||
- | * **obtain.c** | + | * **obtain.c** |
- | * **clear.c** - which will handle | + | * **pos.c** - which will handle |
- | * **rm.c** | + | * **mk.c** |
- | * **swap.c** | + | * **rm.c** |
- | * **sort.c** | + | * **insert.c** |
+ | * **append.c** | ||
+ | * **display.c** | ||
- | Take a look at the code there. These are the files that contain functions which will be compiled and archived into the node library (**liblist.a**) we will be using in this and future projects. | + | Take a look at the code there. These are the files that contain functions which will be compiled and archived into the group library (**libgroup.a**) we will be using in this and future projects. |
Figure out what is going on, make sure you understand it. | Figure out what is going on, make sure you understand it. | ||
====List library unit tests==== | ====List library unit tests==== | ||
- | In **testing/list/unit/**, you will find these new files: | + | In **testing/group/unit/**, you will find the unit tests and verify scripts for the functions to be implementated in the group library. |
- | * **unit-obtain.c** | + | These are complete runnable programs (when compiled, and linked against the group library, which is all handled for you by the **Makefile** system in place). |
- | * **unit-clearlist.c** | + | |
- | * **unit-rmlist.c** | + | |
- | * **unit-swapnode.c** | + | |
- | * **unit-sortlist.c** | + | |
- | + | ||
- | These are complete runnable programs (when compiled, and linked against the list library, which is all handled for you by the **Makefile** system in place). | + | |
Of particular importance, I want you to take a close look at: | Of particular importance, I want you to take a close look at: | ||
Line 65: | Line 118: | ||
* ask questions to get clarification! | * ask questions to get clarification! | ||
- | ====list testing applications==== | ||
- | |||
- | ===palindrome=== | ||
- | Now that we've completed our list functionality, | ||
- | |||
- | Our first endeavor will be that of palindromes (ie words/ | ||
- | |||
- | This implementation will be considered an extra credit opportunity, | ||
- | |||
- | It is also highly recommended to undertake as it will give you further experience working with these concepts. | ||
=====Expected Results===== | =====Expected Results===== | ||
- | To assist you in verifying a correct implementation, | + | To assist you in verifying a correct implementation, |
====node library==== | ====node library==== | ||
Line 83: | Line 126: | ||
<cli> | <cli> | ||
- | lab46: | + | lab46: |
==================================================== | ==================================================== | ||
= Verifying Singly-Linked Node Functionality | = Verifying Singly-Linked Node Functionality | ||
Line 93: | Line 136: | ||
[RESULTS] Total: | [RESULTS] Total: | ||
==================================================== | ==================================================== | ||
- | lab46: | + | lab46: |
</ | </ | ||
====list library==== | ====list library==== | ||
- | Here is what you should get for all the functions completed so far in the list library (sll0+sll1+sll2): | + | Here is what you should get for all the functions completed so far in the list library (sll0+sll1+sll2+sll3): |
<cli> | <cli> | ||
- | lab46: | + | lab46: |
====================================================== | ====================================================== | ||
= | = | ||
====================================================== | ====================================================== | ||
- | [mklist] Total: | + | [mklist] Total: |
- | [insert] Total: | + | [insert] Total: |
[displayf] Total: | [displayf] Total: | ||
[getpos] Total: | [getpos] Total: | ||
[setpos] Total: | [setpos] Total: | ||
- | [append] Total: | + | [append] Total: |
[searchlist] Total: | [searchlist] Total: | ||
- | [cplist] Total: | + | [cplist] Total: |
[displayb] Total: | [displayb] Total: | ||
| | ||
- | [obtain] Total: | + | [obtain] Total: |
| | ||
[rmlist] Total: | [rmlist] Total: | ||
Line 120: | Line 163: | ||
[sortlist] Total: | [sortlist] Total: | ||
====================================================== | ====================================================== | ||
- | | + | |
+ | ====================================================== | ||
+ | lab46: | ||
+ | </ | ||
+ | |||
+ | ====group library==== | ||
+ | Here is what you should get for all the functions completed in the group library: | ||
+ | |||
+ | < | ||
+ | lab46: | ||
+ | ====================================================== | ||
+ | = Verifying Singly-Linked Group List Functionality | ||
+ | ====================================================== | ||
+ | | ||
+ | [ldisplay] Total: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ====================================================== | ||
+ | | ||
====================================================== | ====================================================== | ||
- | lab46: | + | lab46: |
</ | </ | ||
=====Submission Criteria===== | =====Submission Criteria===== |