diff options
| author | Blake Romero <blake@blkrom.com> | 2024-09-19 18:15:46 +0100 |
|---|---|---|
| committer | Blake Romero <blake@blkrom.com> | 2024-10-30 10:13:26 +0000 |
| commit | f9a3e235fb49db3b5f2c09bd14fa799c101dd37f (patch) | |
| tree | 81b40658d0cae2a56a468a3a078842ab700e9de9 /tests | |
| parent | 80bc109350c9d7d49083c0b92b13df3bd3326477 (diff) | |
Fix & update tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/lltests.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/tests/lltests.c b/tests/lltests.c index 2c44bc0..a2c8195 100644 --- a/tests/lltests.c +++ b/tests/lltests.c @@ -6,12 +6,14 @@ Node* head = NULL; // Run on every test void setup() { head = llnode(7); - llpush(&head,9); } // Run after every test -void teardown() {} +void teardown() { + llfree(&head); +} +// Configure test suite TestSuite(lltest, .init=setup, .fini=teardown); // Node @@ -22,6 +24,11 @@ Test(lltest,llnode) { cr_expect(head->value == val); } +// Length +Test(lltest,lllength) { + cr_expect(lllength(head) == 1); +} + // Push Test(lltest,llpush) { int val = 12; @@ -33,8 +40,8 @@ Test(lltest,llpush) { // Pop Test(lltest,llpop) { int val = llpop(&head); - cr_expect(val == 9); - cr_expect(lllength(head) == 1); + cr_expect(val == 7); + cr_expect(lllength(head) == 0); } // Append @@ -46,8 +53,5 @@ Test(lltest,llpop) { // Remove // ... -// Length -// ... - // Free // ... |
