diff options
author | Michael Bien <[email protected]> | 2010-01-13 00:16:50 +0100 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-01-13 00:16:50 +0100 |
commit | 9343c3ef5829f74207a8d220cb3b082211b910f2 (patch) | |
tree | ce01d1a4a0dfbbbdf763fa3b6883e525a47e0e74 /test/com/mbien/opencl/TestUtils.java | |
parent | 4aebe5715b7d61591c8e0b677e452b3905e5ecd6 (diff) |
refactored HighLevelBindingTest into seperate tests.
added CLConcurrencyTest and fixed some bugs in CLEvent codepaths.
Diffstat (limited to 'test/com/mbien/opencl/TestUtils.java')
-rw-r--r-- | test/com/mbien/opencl/TestUtils.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/com/mbien/opencl/TestUtils.java b/test/com/mbien/opencl/TestUtils.java index 70bade8a..803474e5 100644 --- a/test/com/mbien/opencl/TestUtils.java +++ b/test/com/mbien/opencl/TestUtils.java @@ -3,11 +3,19 @@ package com.mbien.opencl; import java.nio.ByteBuffer; import java.util.Random; +import static java.lang.System.*; +import static org.junit.Assert.*; + /** * @author Michael Bien */ public class TestUtils { + //decrease this value on systems with few memory. + final static int ONE_MB = 1048576; + + final static int NUM_ELEMENTS = 10000000; + public static final void fillBuffer(ByteBuffer buffer, int seed) { Random rnd = new Random(seed); @@ -26,4 +34,19 @@ public class TestUtils { return globalSize + groupSize - r; } } + + public static final void checkIfEqual(ByteBuffer a, ByteBuffer b, int elements) { + for(int i = 0; i < elements; i++) { + int aVal = a.getInt(); + int bVal = b.getInt(); + if(aVal != bVal) { + out.println("a: "+aVal); + out.println("b: "+bVal); + out.println("position: "+a.position()); + fail("a!=b"); + } + } + a.rewind(); + b.rewind(); + } } |