summaryrefslogtreecommitdiff
path: root/utests/compiler_write_only.cpp
diff options
context:
space:
mode:
authorBenjamin Segovia <segovia.benjamin@gmail.com>2012-05-03 15:14:53 +0000
committerKeith Packard <keithp@keithp.com>2012-08-10 16:16:57 -0700
commit1a9bcd8ff623a0b96cb034df711e4b02bfab8c6e (patch)
treebb3085d39b10c5ca759466675f7c648cafd6fc4d /utests/compiler_write_only.cpp
parent97c10d0a80665562cd4980fa9a8b4e5a52750f3a (diff)
downloadbeignet-1a9bcd8ff623a0b96cb034df711e4b02bfab8c6e.tar.gz
tests -> utests
Diffstat (limited to 'utests/compiler_write_only.cpp')
-rw-r--r--utests/compiler_write_only.cpp44
1 files changed, 44 insertions, 0 deletions
diff --git a/utests/compiler_write_only.cpp b/utests/compiler_write_only.cpp
new file mode 100644
index 00000000..b5b1afe2
--- /dev/null
+++ b/utests/compiler_write_only.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * Author: Benjamin Segovia <benjamin.segovia@intel.com>
+ */
+
+#include "utest_helper.hpp"
+
+int
+main (int argc, char *argv[])
+{
+ const size_t n = 2048;
+ int status = 0, i;
+
+ CALL (cl_test_init, "test_write_only.cl", "test_write_only", SOURCE);
+ OCL_CREATE_BUFFER(buf[0], 0, n * sizeof(uint32_t), NULL);
+ OCL_SET_ARG(0, sizeof(cl_mem), &buf[0]);
+ globals[0] = n;
+ locals[0] = 16;
+ OCL_NDRANGE(1);
+ OCL_MAP_BUFFER(0);
+ for (i = 0; i < n; ++i) assert(((int*)buf_data[0])[i] == i);
+ OCL_UNMAP_BUFFER(0);
+
+error:
+ cl_release_buffers();
+ cl_report_error(status);
+ cl_test_destroy();
+ return status;
+}
+