Added getSum and getProd functions

This commit is contained in:
2019-03-10 18:39:51 -04:00
parent a494acf34f
commit 5eb4931002
2 changed files with 48 additions and 0 deletions

View File

@@ -154,6 +154,30 @@ int main(){
return 1;
}
//Test the getProd function
if(getSumDynamicInt64Array(&testAry) == 21){
printf("getSum is working correctly\n");
}
else{
printf("There is something wrong with getSum\nThe sum returned is %d\nThe sum should be %d", getSumDynamicInt64Array(&testAry), 21);
return 1;
}
//Test the getSum function
if(getProdDynamicInt64Array(&testAry) != 0){
printf("There is something wrong with getProd\nThe product returned is %d\nThe product should be%d", getProdDynamicInt64Array(&testAry), 0);
return 1;
}
//Pop off the first 0 so there will be a number in the product
removeDynamicInt64Array(&testAry, 0);
if(getProdDynamicInt64Array(&testAry) == 720){
printf("getProd is working correctly\n");
}
else{
printf("There is something wrong with getProd\nThe product returned is %d\nThe product should be%d", getProdDynamicInt64Array(&testAry), 720);
return 1;
}
//Release all of the memory allocated by the array
destroyDynamicInt64Array(&testAry);