diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-07 12:15:01 -0500 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-07 12:15:01 -0500 |
commit | ccce1755276f22ce1e67a70a6b7be2c61986ea12 (patch) | |
tree | 9fee463f1be98ab0d778946cfabb1517389bdc7d | |
parent | 47845837703a55332168927324d501cd2a6bba44 (diff) |
Add modulo tests
-rw-r--r-- | run_tests.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/run_tests.sh b/run_tests.sh index b8088f0..ea83e92 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -1,3 +1,6 @@ +MAX_SINT="2147483647" +MIN_SING="-2147483648" + (( FAIL = 0 )) (( PASS = 0 )) @@ -65,4 +68,25 @@ run_test "./math-int div -25 -5 5" #Two nefative args with remainder run_test "./math-int div -24 -5 4" +################################################################################ +#Integer Modulo # +################################################################################ + +#Test Modulo is zero +run_test "./math-int mod 18 6 0" +#Test Modulo is non-zero +run_test "./math-int mod 59 12 11" +#Test arg0 negative modulo is zero +run_test "./math-int mod -20 5 0" +#Test arg0 negative modulo is non-zero (In the real world -18 % 5 = 2) +run_test "./math-int mod -18 5 -3" +#Test arg1 negative modulo is zero +run_test "./math-int mod 50 -10 0" +#Test arg1 negative modulo is non-zero (In the real world 16 % -3 = -2) +run_test "./math-int mod 16 -3 1" +#Test arg1 = MAX_SINT +run_test "./math-int mod ${MAX_SINT} 12345 9172" +#Test arg1 = MIN_SINT (In the real world MIN_SING % 476 = 348) +run_test "./math-int mod ${MIN_SINT} 476 -128" + echo "$PASS passes, $FAIL fails" |