Search in sources :

Example 91 with com.oracle.tck.lib.autd2

use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.

the class ReferenceAttachedToParam method class_1.

@org.junit.Test
public void class_1() {
    final List<Class<?>> list = new ArrayList<Class<?>>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        Class<?>[] classes = { String.class, Throwable.class };

        @TestCase
        public void test(@TestData("classes") Class<?> c) throws Throwable {
            list.add(c);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(2, list.size());
    Assert.assertEquals(String.class, list.get(0));
    Assert.assertEquals(Throwable.class, list.get(1));
}
Also used : TestCase(com.sun.tck.test.TestCase) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup)

Example 92 with com.oracle.tck.lib.autd2

use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.

the class ReferenceAttachedToParam method mixed_default.

@org.junit.Test
public void mixed_default() {
    final List<Class<?>> list_1 = new ArrayList<Class<?>>();
    final List<String> list_2 = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        Values strings_ = DataFactory.createColumn("a", "b", "c");

        Class<?>[] classes = { String.class, Throwable.class };

        @TestCase
        public void test(@TestData("classes") Class<?> c, @TestData("strings_") String s) throws Throwable {
            list_1.add(c);
            list_2.add(s);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(3, list_1.size());
    Assert.assertEquals(3, list_2.size());
    Assert.assertEquals(String.class, list_1.get(0));
    Assert.assertEquals(Throwable.class, list_1.get(1));
    Assert.assertEquals(String.class, list_1.get(2));
    Assert.assertEquals("a", list_2.get(0));
    Assert.assertEquals("b", list_2.get(1));
    Assert.assertEquals("c", list_2.get(2));
}
Also used : ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 93 with com.oracle.tck.lib.autd2

use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.

the class ReferenceAttachedToParam method shorts_1.

@org.junit.Test
public void shorts_1() {
    final List<Integer> list = new ArrayList<Integer>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        Values ints = DataFactory.createColumn(23, 423);

        @TestCase
        public void test(@TestData("ints") int i) throws Throwable {
            list.add(i);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(2, list.size());
    Assert.assertEquals(23, list.get(0), 0.0);
    Assert.assertEquals(423, list.get(1), 0.0);
}
Also used : TestCase(com.sun.tck.test.TestCase) ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup)

Example 94 with com.oracle.tck.lib.autd2

use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.

the class ReferenceAttachedToParam method mixed_mult_2.

@org.junit.Test
public void mixed_mult_2() {
    final List<Class<?>> list_1 = new ArrayList<Class<?>>();
    final List<String> list_2 = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        Values strings_ = DataFactory.createColumn("aa", "bb", "cc");

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@Classes({ String.class, Throwable.class }) Class<?> c, @TestData("strings_") String s) throws Throwable {
            list_1.add(c);
            list_2.add(s);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, list_1.size());
    Assert.assertEquals(6, list_2.size());
    Assert.assertEquals(String.class, list_1.get(0));
    Assert.assertEquals(String.class, list_1.get(1));
    Assert.assertEquals(String.class, list_1.get(2));
    Assert.assertEquals(Throwable.class, list_1.get(3));
    Assert.assertEquals(Throwable.class, list_1.get(4));
    Assert.assertEquals(Throwable.class, list_1.get(5));
    Assert.assertEquals("aa", list_2.get(0));
    Assert.assertEquals("bb", list_2.get(1));
    Assert.assertEquals("cc", list_2.get(2));
    Assert.assertEquals("aa", list_2.get(3));
    Assert.assertEquals("bb", list_2.get(4));
    Assert.assertEquals("cc", list_2.get(5));
}
Also used : ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase)

Example 95 with com.oracle.tck.lib.autd2

use of com.oracle.tck.lib.autd2 in project jtharness by openjdk.

the class General method test_2.

@Test
public void test_2() {
    List<Object[]> expected = new ArrayList<Object[]>();
    final List<Object[]> actual = new ArrayList<Object[]>();
    expected.add(new Object[] { "a", 1 });
    expected.add(new Object[] { "b", 2 });
    BaseTestGroup test = new BaseTestGroup() {

        Values sampleSetup() {
            return DataFactory.createColumn("a", "b").pseudoMultiply(1, 2);
        }

        @TestCase
        @TestData("sampleSetup")
        public void test(String s, int i) {
            actual.add(new Object[] { s, i });
        }
    };
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(test);
    ValuesComparison.compare(expected, actual);
    Assert.assertTrue(status.isOK());
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Test(org.junit.Test)

Aggregations

TestCase (com.sun.tck.test.TestCase)139 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)135 Test (org.junit.Test)107 ArrayList (java.util.ArrayList)73 TestData (com.sun.tck.lib.tgf.TestData)61 TestResult (com.oracle.tck.lib.autd2.TestResult)52 Values (com.sun.tck.lib.tgf.Values)50 TestGroup (com.sun.tck.test.TestGroup)30 HashSet (java.util.HashSet)13 DataFactory.createValues (com.sun.tck.lib.tgf.DataFactory.createValues)12 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)11 Operation (com.sun.tck.lib.tgf.data.Operation)10 TestObject (com.oracle.tck.lib.autd2.unittests.TestObject)8 Color (java.awt.Color)7 List (java.util.List)5 DataFactory (com.sun.tck.lib.tgf.DataFactory)4 DataFactory.createColumn (com.sun.tck.lib.tgf.DataFactory.createColumn)3 DataFactory.createRow (com.sun.tck.lib.tgf.DataFactory.createRow)3 PrintWriter (java.io.PrintWriter)3 java.util (java.util)3