diff options
author | Tom Stellard <thomas.stellard@amd.com> | 2012-03-06 17:35:49 -0500 |
---|---|---|
committer | Tom Stellard <thomas.stellard@amd.com> | 2012-03-06 17:35:49 -0500 |
commit | 47845837703a55332168927324d501cd2a6bba44 (patch) | |
tree | 5f927b0e1062d8b2e5c79f689348a1fc39118d81 | |
parent | bef83647a9179560201fa969f5e67507f9f94974 (diff) |
Add integer division tests
-rw-r--r-- | div.cl | 4 | ||||
-rw-r--r-- | run_tests.sh | 25 |
2 files changed, 29 insertions, 0 deletions
@@ -0,0 +1,4 @@ +__kernel void div(__global int * out, int arg0, int arg1) +{ + out[0] = arg0 / arg1; +} diff --git a/run_tests.sh b/run_tests.sh index da77d7f..b8088f0 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -40,4 +40,29 @@ run_test "./math-int mul -3 8 -24" #Test multiply negative by negative run_test "./math-int mul -12 -6 72" +################################################################################ +#Integer divide # +################################################################################ + +#Test even divide +run_test "./math-int div 20 5 4" +#Test divide with remainder +run_test "./math-int div 23 5 4" +#Test divide by 1 +run_test "./math-int div 30 1 30" +#Test divide by -1 +run_test "./math-int div 57 -1 -57" +#Test divide by a negative number +run_test "./math-int div 10 -2 -5" +#Test divide by a negative number with remainder +run_test "./math-int div 17 -3 -5" +#Test divide a negative number +run_test "./math-int div -28 2 -14" +#Test divide a negative number with remainder +run_test "./math-int div -8 3 -2" +#Two negative args +run_test "./math-int div -25 -5 5" +#Two nefative args with remainder +run_test "./math-int div -24 -5 4" + echo "$PASS passes, $FAIL fails" |