[Beignet] [PATCH] Fix several typos in unit test.

Ruiling Song ruiling.song at intel.com
Tue Jun 18 19:04:54 PDT 2013


compiler_sub_bytes and compiler_sub_shorts

Signed-off-by: Ruiling Song <ruiling.song at intel.com>
---
 utests/compiler_sub_bytes.cpp  |    4 ++--
 utests/compiler_sub_shorts.cpp |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/utests/compiler_sub_bytes.cpp b/utests/compiler_sub_bytes.cpp
index 49a5261..740a8fd 100644
--- a/utests/compiler_sub_bytes.cpp
+++ b/utests/compiler_sub_bytes.cpp
@@ -11,7 +11,7 @@ static void compiler_sub_bytes(void)
   for (uint32_t i = 0; i < n; ++i) ((int8_t*)buf_data[0])[i] = (int8_t) rand();
   for (uint32_t i = 0; i < n; ++i) ((int8_t*)buf_data[1])[i] = (int8_t) rand();
   OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(int8_t), buf_data[0]);
-  OCL_CREATE_BUFFER(buf[1], CL_MEM_COPY_HOST_PTR, n * sizeof(int8_t), buf_data[0]);
+  OCL_CREATE_BUFFER(buf[1], CL_MEM_COPY_HOST_PTR, n * sizeof(int8_t), buf_data[1]);
   OCL_CREATE_BUFFER(buf[2], 0, n * sizeof(int8_t), NULL);
 
   // Run the kernel
@@ -25,7 +25,7 @@ static void compiler_sub_bytes(void)
   // Check result
   OCL_MAP_BUFFER(2);
   for (uint32_t i = 0; i < n; ++i)
-    OCL_ASSERT(((int8_t*)buf_data[2])[i] = ((int8_t*)buf_data[0])[i] - ((int8_t*)buf_data[1])[i]);
+    OCL_ASSERT(((int8_t*)buf_data[2])[i] == (int8_t)(((int8_t*)buf_data[0])[i] - ((int8_t*)buf_data[1])[i]));
   free(buf_data[0]);
   free(buf_data[1]);
   buf_data[0] = buf_data[1] = NULL;
diff --git a/utests/compiler_sub_shorts.cpp b/utests/compiler_sub_shorts.cpp
index 4aeeca3..7c24a56 100644
--- a/utests/compiler_sub_shorts.cpp
+++ b/utests/compiler_sub_shorts.cpp
@@ -11,7 +11,7 @@ static void compiler_sub_shorts(void)
   for (uint32_t i = 0; i < n; ++i) ((int16_t*)buf_data[0])[i] = (int16_t) rand();
   for (uint32_t i = 0; i < n; ++i) ((int16_t*)buf_data[1])[i] = (int16_t) rand();
   OCL_CREATE_BUFFER(buf[0], CL_MEM_COPY_HOST_PTR, n * sizeof(int16_t), buf_data[0]);
-  OCL_CREATE_BUFFER(buf[1], CL_MEM_COPY_HOST_PTR, n * sizeof(int16_t), buf_data[0]);
+  OCL_CREATE_BUFFER(buf[1], CL_MEM_COPY_HOST_PTR, n * sizeof(int16_t), buf_data[1]);
   OCL_CREATE_BUFFER(buf[2], 0, n * sizeof(int16_t), NULL);
 
   // Run the kernel
@@ -25,7 +25,7 @@ static void compiler_sub_shorts(void)
   // Check result
   OCL_MAP_BUFFER(2);
   for (uint32_t i = 0; i < n; ++i)
-    OCL_ASSERT(((int16_t*)buf_data[2])[i] = ((int16_t*)buf_data[0])[i] - ((int16_t*)buf_data[1])[i]);
+    OCL_ASSERT(((int16_t*)buf_data[2])[i] == (int16_t)(((int16_t*)buf_data[0])[i] - ((int16_t*)buf_data[1])[i]));
   free(buf_data[0]);
   free(buf_data[1]);
   buf_data[0] = buf_data[1] = NULL;
-- 
1.7.9.5



More information about the Beignet mailing list