From 3968765c355c7493a4562c43387ab30873b16735 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sun, 26 Dec 2021 18:01:05 +0000 Subject: [PATCH] Add more tests --- src/test/test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/test/test.c b/src/test/test.c index f6ddd06..04d2683 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -133,6 +133,37 @@ void shouldCopyPopulatedList() { printSuccess(__func__); } +void shouldInsertElementIntoListIndexZero() { + // Arrange + List *list = List_new(); + List_append(list, 1); + + // Act + List_insert(list, 0, 0); + + // Assert + assert(List_get(list, 0) == 0); + List_destroy(&list); + + printSuccess(__func__); +} + +void shouldCopyEmptyList() { + // Arrange + List *list = List_new(); + + // Act + List *copiedList = List_copy(list); + + // Assert + assert(List_length(copiedList) == 0); + assert(List_maxLength(copiedList) == 10); + List_destroy(&list); + List_destroy(&copiedList); + + printSuccess(__func__); +} + int main() { printf("============================================"); printf("\nSTART TESTING"); @@ -143,6 +174,8 @@ int main() { shouldClearList(); shouldReturnListMaxLengthTwenty(); shouldCopyPopulatedList(); + shouldCopyEmptyList(); + shouldInsertElementIntoListIndexZero(); printf("\n\n============================================"); printf("\nFINISH TESTING"); printf("\n============================================");