diff options
-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" |