Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- animeshf@ubuntu:~/Desktop/HW10$ make run-valgrind
- gcc -std=c99 -pedantic -Wall -Werror -Wextra -g -DDEBUG test.o list.o -o test
- valgrind --leak-check=yes --show-reachable=yes --tool=memcheck ./test
- ==13976== Memcheck, a memory error detector
- ==13976== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
- ==13976== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
- ==13976== Command: ./test
- ==13976==
- TEST CASE 1
- An empty list should have size 0:
- Size: 0
- TEST CASE 2
- After adding one element, size should be 1:
- Size: 1
- TEST CASE 3
- Traversal should print the one element:
- Andrew, 26
- TEST CASE 4
- The one element should be the front and back:
- Andrew, 26
- Andrew, 26
- TEST CASE 5
- Andrew should be contained in the list:
- Andrew is in list
- TEST CASE 6
- Collin should not be contained in the list:
- Collin isn't in list
- TEST CASE 7
- Pop Andrew from the front...
- Success!
- TEST CASE 8
- Add Collin, pop from the back...
- Size is 0
- Success!
- TEST CASE 9
- There should be 7 elements in this list:
- Size: 7
- TEST CASE 10
- Front should be last element pushed to front (Leahy):
- Leahy, 66
- TEST CASE 11
- Last element pushed (Nick):
- Nick, 23
- TEST CASE 12
- The person at index 2 should be Andrew:
- Andrew, 25
- TEST CASE 13
- There should be someone age 24 in the list:
- Clayton, 24
- TEST CASE 14
- There should be nobody age 30 in the list:
- Success!
- TEST CASE 15
- Popping front twice leaves a size 5 list:
- Size: 5
- TEST CASE 16
- Print the 5 elements from the list:
- Andrew, 25
- Clayton, 24
- Marie, 22
- Henry, 21
- Nick, 23
- TEST CASE 20
- Let's try making a deep copy of a list of 4 people:
- Original:
- Shayan, 22
- Patrick, 19
- Brandi, 21
- Baijun, 20
- Copy:
- Shayan, 22
- Patrick, 19
- Brandi, 21
- Baijun, 20
- TEST CASE 21
- After emptying first list, second should persist:
- Shayan, 22
- Patrick, 19
- Brandi, 21
- Baijun, 20
- TEST CASE 22
- shallow copy test, both data pointers should be the same
- TEST CASE 23
- reverse test
- TEST CASE 24
- concat test
- TEST CASE 25
- Passing in null lists to functions should return 0...
- Success!
- Make sure to write more test cases as well in test.c! The ones given are NOT comprehensive.
- Also test using valgrind. No credit will be given to functions with memory leaks or memory errors.
- ==13976==
- ==13976== HEAP SUMMARY:
- ==13976== in use at exit: 0 bytes in 0 blocks
- ==13976== total heap usage: 109 allocs, 109 frees, 2,602 bytes allocated
- ==13976==
- ==13976== All heap blocks were freed -- no leaks are possible
- ==13976==
- ==13976== For counts of detected and suppressed errors, rerun with: -v
- ==13976== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement