mirror of
https://bitbucket.org/Mattrixwv/myhelpers.git
synced 2025-12-06 18:43:59 -05:00
Added sort functions
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user