summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--div.cl4
-rw-r--r--run_tests.sh25
2 files changed, 29 insertions, 0 deletions
diff --git a/div.cl b/div.cl
new file mode 100644
index 0000000..12c8bbd
--- /dev/null
+++ b/div.cl
@@ -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"