Search in sources :

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

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

the class Examples method test_05_02_01.

@Test
public void test_05_02_01() {
    @TestGroup
    class TestTransformingIterator {

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { { 1 }, { 3, 4 } }).filter((Object[] i) -> DataFactory.createRow(i.length));

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Integer d) {
        }
    }
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new TestTransformingIterator());
    Assert.assertTrue(s.isOK());
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : Values(com.sun.tck.lib.tgf.Values) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

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

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

the class Examples method test_03_array_01_old_approach_twoArrays.

@Test
public void test_03_array_01_old_approach_twoArrays() {
    @TestGroup
    class Test {

        Values mix = createColumn(new Color[] { BLACK, BLACK, RED, ORANGE }, new Color[] { BLUE }, new Color[] { BLUE }, new Color[] { RED, WHITE }).multiply(new Color[] { BLACK, BLACK, RED, ORANGE }, new Color[] { BLUE }, new Color[] { BLUE }, new Color[] { RED, WHITE }).filter(new Object() {

            @Transform
            Values t(Color[] c1s, Color[] c2s) {
                return createRow(c1s[0].getBlue() + c2s[0].getRed());
            }
        });

        @TestCase
        @TestData("mix")
        public void test(int mix) {
            assertTrue(mix >= 0);
        }
    }
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new Test());
    Assert.assertTrue(s.isOK());
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : Test(org.junit.Test) Color(java.awt.Color) Values(com.sun.tck.lib.tgf.Values) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

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

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

the class Examples method test_05_01.

@Test
public void test_05_01() {
    @TestGroup
    class TestTransformingIterator {

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { { 1, 2 }, { 3, 4 } }).multiply(DataFactory.createValues(new Comparable<?>[][] { { 5, 6 }, { 7, 8 } })).filter((Object[] i) -> DataFactory.createRow(i));

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Comparable<?> a, Comparable<?> b, Comparable<?> c, Comparable<?> d) {
            System.out.println("TestTransformingIterator.testToString");
        }
    }
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new TestTransformingIterator());
    Assert.assertTrue(s.isOK());
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : Values(com.sun.tck.lib.tgf.Values) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

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

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

the class Examples method test_05_02.

@Test
public void test_05_02() {
    @TestGroup
    class TestTransformingIterator {

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { { 1 }, { 3 } }).filter((Object[] i) -> DataFactory.createRow(i.length));

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Integer d) {
        }
    }
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new TestTransformingIterator());
    Assert.assertTrue(s.isOK());
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : Values(com.sun.tck.lib.tgf.Values) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

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

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

the class Examples method test_06.

@Test(expected = java.lang.RuntimeException.class)
public // TODO rethink TransformingIterator design to make this possible
void test_06() {
    @TestGroup
    class TestTransformingIterator {

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { { 1, 2 }, { 3, 4 } }).multiply(DataFactory.createValues(new Comparable<?>[][] { { 5, 6 }, { 7, 8 } })).filter((Comparable<?>... i) -> DataFactory.createRow((Object) i));

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Comparable<?> a) {
        // Control won't come here, it fails at TransformingIterator.
        }
    }
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(new TestTransformingIterator());
    Assert.assertFalse(s.isOK());
}
Also used : Values(com.sun.tck.lib.tgf.Values) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) 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