|
|
@ -39,17 +39,7 @@ void shouldReturnListLengthTwo() {
|
|
|
|
void shouldReturnSortedListInAscendingOrder() {
|
|
|
|
void shouldReturnSortedListInAscendingOrder() {
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
List *list = List_new();
|
|
|
|
List *list = List_new();
|
|
|
|
List_append(list, 10);
|
|
|
|
List_append_all(list, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
|
|
|
|
List_append(list, 9);
|
|
|
|
|
|
|
|
List_append(list, 8);
|
|
|
|
|
|
|
|
List_append(list, 7);
|
|
|
|
|
|
|
|
List_append(list, 6);
|
|
|
|
|
|
|
|
List_append(list, 5);
|
|
|
|
|
|
|
|
List_append(list, 4);
|
|
|
|
|
|
|
|
List_append(list, 3);
|
|
|
|
|
|
|
|
List_append(list, 2);
|
|
|
|
|
|
|
|
List_append(list, 1);
|
|
|
|
|
|
|
|
List_append(list, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
// Act
|
|
|
|
int returnCode = List_sort(list, false);
|
|
|
|
int returnCode = List_sort(list, false);
|
|
|
@ -85,16 +75,7 @@ void shouldClearList() {
|
|
|
|
void shouldReturnListMaxLengthTwenty() {
|
|
|
|
void shouldReturnListMaxLengthTwenty() {
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
List *list = List_new();
|
|
|
|
List *list = List_new();
|
|
|
|
List_append(list, 0);
|
|
|
|
List_append_all(list, 10, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
|
|
|
|
List_append(list, 1);
|
|
|
|
|
|
|
|
List_append(list, 2);
|
|
|
|
|
|
|
|
List_append(list, 3);
|
|
|
|
|
|
|
|
List_append(list, 4);
|
|
|
|
|
|
|
|
List_append(list, 5);
|
|
|
|
|
|
|
|
List_append(list, 6);
|
|
|
|
|
|
|
|
List_append(list, 7);
|
|
|
|
|
|
|
|
List_append(list, 8);
|
|
|
|
|
|
|
|
List_append(list, 9);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Mid-Assert
|
|
|
|
// Mid-Assert
|
|
|
|
assert(List_max_length(list) == 10);
|
|
|
|
assert(List_max_length(list) == 10);
|
|
|
@ -112,11 +93,7 @@ void shouldReturnListMaxLengthTwenty() {
|
|
|
|
void shouldCopyPopulatedList() {
|
|
|
|
void shouldCopyPopulatedList() {
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
List *list = List_new();
|
|
|
|
List *list = List_new();
|
|
|
|
List_append(list, 0);
|
|
|
|
List_append_all(list, 5, 0, 1, 2, 3, 4);
|
|
|
|
List_append(list, 1);
|
|
|
|
|
|
|
|
List_append(list, 2);
|
|
|
|
|
|
|
|
List_append(list, 3);
|
|
|
|
|
|
|
|
List_append(list, 4);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
// Act
|
|
|
|
List *copiedList = List_copy(list);
|
|
|
|
List *copiedList = List_copy(list);
|
|
|
@ -167,10 +144,7 @@ void shouldCopyEmptyList() {
|
|
|
|
void shouldRemoveElementFromList() {
|
|
|
|
void shouldRemoveElementFromList() {
|
|
|
|
// Arrange
|
|
|
|
// Arrange
|
|
|
|
List *list = List_new();
|
|
|
|
List *list = List_new();
|
|
|
|
List_append(list, 0);
|
|
|
|
List_append_all(list, 4, 0, 1, 2, 0);
|
|
|
|
List_append(list, 1);
|
|
|
|
|
|
|
|
List_append(list, 2);
|
|
|
|
|
|
|
|
List_append(list, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Act
|
|
|
|
// Act
|
|
|
|
List_remove(list, 0);
|
|
|
|
List_remove(list, 0);
|
|
|
|