From 91b3f374dfa5be528d30c94f258726a9efa42230 Mon Sep 17 00:00:00 2001 From: log2 <logtwo2@gmail.com> Date: Sat, 15 Nov 2014 21:18:55 +0100 Subject: [PATCH] Aligned with changes in ClassModel, modified one assert from assertTrue to assertEquals in order to better visualize generated code misalignments (especially under Eclipse) --- .../src/java/com/amd/aparapi/CodeGenJUnitBase.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/codegen/src/java/com/amd/aparapi/CodeGenJUnitBase.java b/test/codegen/src/java/com/amd/aparapi/CodeGenJUnitBase.java index 37c77c41..0549e736 100644 --- a/test/codegen/src/java/com/amd/aparapi/CodeGenJUnitBase.java +++ b/test/codegen/src/java/com/amd/aparapi/CodeGenJUnitBase.java @@ -37,14 +37,17 @@ under those regulations, please refer to the U.S. Bureau of Industry and Securit */ package com.amd.aparapi; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; +import java.util.Arrays; + import com.amd.aparapi.internal.exception.AparapiException; import com.amd.aparapi.internal.model.ClassModel; import com.amd.aparapi.internal.model.Entrypoint; import com.amd.aparapi.internal.writer.KernelWriter; -public class CodeGenJUnitBase{ +public class CodeGenJUnitBase { protected void test(Class<?> _class, Class<? extends AparapiException> _expectedExceptionType, String[] expectedOpenCL) { try { @@ -53,7 +56,7 @@ public class CodeGenJUnitBase{ // String expected = source.getOpenCLString(); - ClassModel classModel = new ClassModel(_class); + ClassModel classModel = ClassModel.createClassModel(_class); // construct an artficial instance of our class here // we assume the specified class will have a null constructor @@ -94,11 +97,15 @@ public class CodeGenJUnitBase{ .println("}\n------------------------------------------------------------------------------------------------------"); } - assertTrue(_class.getSimpleName(), same); + if (!same) { + assertEquals(_class.getSimpleName(), Arrays.toString(expectedOpenCL), actual); + } } else { assertTrue("Expected exception " + _expectedExceptionType + " Instead we got {\n" + actual + "\n}", false); } + } catch (AssertionError e) { + throw e; } catch (Throwable t) { if (_expectedExceptionType == null || !t.getClass().isAssignableFrom(_expectedExceptionType)) { t.printStackTrace(); -- GitLab