Add test for List_remove()

main
Hammy 3 years ago
parent 03e4007c2a
commit 8bddbe6a7c

@ -164,6 +164,27 @@ void shouldCopyEmptyList() {
printSuccess(__func__); printSuccess(__func__);
} }
void shouldRemoveElementFromList() {
// Arrange
List *list = List_new();
List_append(list, 0);
List_append(list, 1);
List_append(list, 2);
List_append(list, 0);
// Act
List_remove(list, 0);
// Assert
assert(List_length(list) == 3);
assert(List_get(list, 0) == 1);
assert(List_get(list, 1) == 2);
assert(List_get(list, 2) == 0);
List_destroy(&list);
printSuccess(__func__);
}
int main() { int main() {
printf("============================================"); printf("============================================");
printf("\nSTART TESTING"); printf("\nSTART TESTING");
@ -176,6 +197,7 @@ int main() {
shouldCopyPopulatedList(); shouldCopyPopulatedList();
shouldCopyEmptyList(); shouldCopyEmptyList();
shouldInsertElementIntoListIndexZero(); shouldInsertElementIntoListIndexZero();
shouldRemoveElementFromList();
printf("\n\n============================================"); printf("\n\n============================================");
printf("\nFINISH TESTING"); printf("\nFINISH TESTING");
printf("\n============================================"); printf("\n============================================");

Loading…
Cancel
Save