Document Analysis Project in C Part 2
This second part of the project builds upon the set of library functions from part 1.
Implement the functions in the order specified below. You are required to submit your code after
completing each function. An extensive set of unit tests is included along with a Makefile.
- All of your code will be implemented in the analysis.c and unit_tests_student.c files. Detailed descriptions
of the operation of each function are included in this source code file. These are the only two source code files that will be graded.
- Copy your linked_list_function.c from Part 1 to your new Part 2 directory.
- Do not make any changes to any of the other files.
- You are not allowed to change the design of the functions in analysis.c.
- You will be graded on both the quality of your code and the number of provided unit tests that pass.
- Incremental development is required. You must submit your code after completing each function.
Do not start the next function until you get the previous function working.
- In your activity journal be sure to enter an estimate for each function before starting the code.
- Update your activity journal with your time spent and observations when implementing that one function.
- Submit your code when that function passes its unit tests. You must include your updated Activity Journal.
- Do not start the next function until the previous function is working.
If you must continue with one or two tests still failing be aware that this may cause problems with the subsequent functions.
- Implement and submit the functions in this order (as shown in the ActivityJournal):
- read_file through test 56
- read_file MLK_dream_excerpt only
- Add four unit tests to the unit_tests_student.c file
Unit Testing Notes
The zip file contains all of the files you need for the unit tests. These text files
(empty.txt, one_word.txt, five_words.txt, and MLK_dream_excerpt.txt) must not be changed.
The unit tests use these file to test your code.
Running the unit tests
- If you run analysis with no parameters then it will run all tests (linked list, analysis, and student)
- If you run it this way you will just run the tests of your linked_list_function code from Part 1:
./test linked (l is sufficient)
- If you run it this way you will just run your student created unit tests along with the two provided tests in unit_tests_student.c:
./test student (s is sufficient)
- Use fopen() to open the text file. Use the "r" parameter to open it read it.
- Use the resulting FILE pointer with fgetc() to read one character at a time from the text file.
- When done reading the file be sure to close that file using fclose().
- To create the CSV file use fopen() with the "w" parameter to write a new file.
- To test your CSV code compare your output to the expected output file MLK.csv.
- (10) Overall code quality including effectively using your linked_list_functions from Part 1
- (10) Incremental development with at least one submission per function
- ( 5) Correct submission and code compiles and links without warnings with provided Makefile
- ( 5) All unit tests run without crashing (no segment faults and no infinite loops)
- (10) process_word
- ( 5) get_first_word
- ( 5) get_next_word
- ( 5) get_last_word
- ( 5) get_prev_word
- (15) read_file through test 56
- (10) read_file MLK_dream_excerpt only
- (10) write_unique_word_list_to_csv_file
- ( 5) Add four unit tests to the unit_tests_student.c file
The following update zip file has the solution (as an object file) for part 1 linked_list_functions with a Makefile
that uses that object file. It also has a version of the analysis.c file that has the file I/O code provided. You can
copy the file I/O code into your analysis.c file if you have already started updating analysis.c. If not just rename the
analysis_with_file_io.c to analysis.c and start implementing your code in that file.
Place your completed analysis.c, linked_list_functions.c, unit_tests_student.c, and ActivityJournal.txt files in a directory named
analysis_part2 at the top level of your git repo.
NOTE: Submit your final version of the linked_list_functions.c file from Part 1. In most cases this will be the same
as your Part 1 submission. You may find errors in this code during Part 2 development. This will not improve your Part 1 grade.
Be very careful to not change the original design of the linked_list_functions from Part 1.