aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/lltests.c18
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
// ...