Add more tests

main
Hammy 3 years ago
parent 328482dc55
commit 3968765c35

@ -133,6 +133,37 @@ void shouldCopyPopulatedList() {
printSuccess(__func__); 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() { int main() {
printf("============================================"); printf("============================================");
printf("\nSTART TESTING"); printf("\nSTART TESTING");
@ -143,6 +174,8 @@ int main() {
shouldClearList(); shouldClearList();
shouldReturnListMaxLengthTwenty(); shouldReturnListMaxLengthTwenty();
shouldCopyPopulatedList(); shouldCopyPopulatedList();
shouldCopyEmptyList();
shouldInsertElementIntoListIndexZero();
printf("\n\n============================================"); printf("\n\n============================================");
printf("\nFINISH TESTING"); printf("\nFINISH TESTING");
printf("\n============================================"); printf("\n============================================");

Loading…
Cancel
Save