From 50aa34ce7a13dfdb6c2c7ca87c57fce1e2f1ba01 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 16 Mar 2012 14:44:28 -0400 Subject: Add tests for if (x > y) --- if_gt.cl | 7 +++++++ run_tests.sh | 16 ++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 if_gt.cl diff --git a/if_gt.cl b/if_gt.cl new file mode 100644 index 0000000..1ffed51 --- /dev/null +++ b/if_gt.cl @@ -0,0 +1,7 @@ +__kernel void if_gt(__global int * out, int arg0, int arg1) +{ + out[0] = 0; + if (arg0 > arg1) { + out[0] = 1; + } +} diff --git a/run_tests.sh b/run_tests.sh index 5f2e461..42f21cb 100644 --- a/run_tests.sh +++ b/run_tests.sh @@ -117,5 +117,21 @@ run_test "./get-global-id 2000000 1" #Large number of threads run_test "./get-global-id 5000000 1000" +################################################################################ +#if (x > y) # +################################################################################ + +#True case +run_test "./math-int if_gt 5 4 1" +#False case +run_test "./math-int if_gt 5 6 0" +# x < y but abs(x) > y +run_test "./math-int if_gt -20 10 0" +# x < y and abs(x) > y +run_test "./math-int if_gt -5 8 0" +# x > y, but x < abs(x) +run_test "./math-int if_gt 12 -15 1" +# x > y and x > abs(y) +run_test "./math-int if_gt 16 -3 1" echo "$PASS passes, $FAIL fails" -- cgit v1.2.3