Added sort functions

This commit is contained in:
2019-03-10 11:49:24 -04:00
parent e951c2d9a0
commit a494acf34f
2 changed files with 111 additions and 0 deletions

View File

@@ -122,6 +122,38 @@ int main(){
return 1;
}
//Test the is sorted function
if(!isSortedDynamicInt64Array(&testAry)){
printf("There is something wrong with the isSorted function: Test 1\n");
return 1;
}
pushBackDynamicInt64Array(&testAry, 2);
if(isSortedDynamicInt64Array(&testAry)){
printf("There is something wrong with the isSorted function: Test2\n");
return 1;
}
//Test the bubbleSort function
bubbleSortDynamicInt64Array(&testAry);
if(isSortedDynamicInt64Array(&testAry)){
printf("BubbleSort is working correctly\n");
}
else{
printf("There is something wrong with bubbleSort\n");
return 1;
}
//Test the quickSort function
pushBackDynamicInt64Array(&testAry, 5);
quickSortDynamicInt64Array(&testAry);
if(isSortedDynamicInt64Array(&testAry)){
printf("QuickSort is working correctly\n");
}
else{
printf("There is something wrong with quickSort\n");
return 1;
}
//Release all of the memory allocated by the array
destroyDynamicInt64Array(&testAry);
@@ -140,6 +172,8 @@ The find function is working correctly
The pushback function is working correctly
Removing funcion is working correctly
RemoveLocation function is working correctly
BubbleSort is working correctly
QuickSort is working correctly
END OF TESTS