Search in sources :

Example 31 with TestGroup

use of com.sun.tck.test.TestGroup in project jtharness by openjdk.

the class Examples method from_VMTests.

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

        Values frames() {
            Values rowsOfTypes = DataFactory.createValues(new String[][] { {}, { "a" }, { "a", "b" }, { "a", "b", "c", "d" } });
            Values frames = rowsOfTypes.filter(new Object() {

                @Transform
                public Object transform(Object[] row1) {
                    Object[] copiedArray = Arrays.copyOf(row1, row1.length, (Class<? extends Object[]>) String[].class);
                    return DataFactory.createRow((Object) copiedArray);
                }
            }).filter((String[] stackState) -> new Object());
            return frames;
        }

        @TestCase
        @TestData("frames")
        public void testToString(Object i) {
            System.out.println("TestTransformingIterator.testToString");
            System.out.println("i = " + i);
        }
    }
    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 TestGroup

use of com.sun.tck.test.TestGroup in project jtharness by openjdk.

the class Examples method test_03_array_01_new_approach_twoArrays.

@Test
public void test_03_array_01_new_approach_twoArrays() {
    Assert.assertTrue(Arrays.asList(1, 2, 3) instanceof RandomAccess);
    @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((Color[] c1s, Color[] c2s) -> 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) RandomAccess(java.util.RandomAccess) TestGroup(com.sun.tck.test.TestGroup) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

Example 33 with TestGroup

use of com.sun.tck.test.TestGroup in project jtharness by openjdk.

the class Examples method test_03_array_01_old_approach.

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

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

            @Transform
            Values tr(Object[] colors) {
                return createRow(((Color) colors[0]).getBlue());
            }
        });

        @TestCase
        @TestData("blues")
        public void test(int blue) {
            assertTrue(blue >= 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) 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 TestGroup

use of com.sun.tck.test.TestGroup in project jtharness by openjdk.

the class Examples method test_02.

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

        Values spaces = createColumn(RED, GREEN, WHITE).filter(Color::getColorSpace);

        @TestCase
        public void test(@TestData("spaces") ColorSpace cs) {
            Assert.assertTrue(cs.isCS_sRGB());
        }
    }
    TestResult testResult = TU.runTestGroup(new Test());
    Assert.assertTrue(testResult.isOK());
    Assert.assertEquals("test cases: 1; all passed", testResult.getMessage());
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) Test(org.junit.Test) ColorSpace(java.awt.color.ColorSpace) 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 TestGroup

use of com.sun.tck.test.TestGroup in project jtharness by openjdk.

the class Examples method test_03_array.

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

        Values quantities = createColumn(new Color[] { BLUE, BLACK, WHITE }, new Color[] { BLACK, WHITE, BLUE, GREEN }, new Color[] { BLUE, BLACK }, new Color[] { RED }).<Color[]>filter(colors -> createRow(colors.length));

        @TestCase
        @TestData("quantities")
        public void test(int quantity) {
            assertTrue(quantity > 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 : Color(java.awt.Color) IntStream(java.util.stream.IntStream) TestData(com.sun.tck.lib.tgf.TestData) DataFactory(com.sun.tck.lib.tgf.DataFactory) Arrays(java.util.Arrays) Longs(com.sun.tck.lib.tgf.data.Longs) MULTIPLY(com.sun.tck.lib.tgf.data.Operation.TYPE.MULTIPLY) Test(org.junit.Test) TestResult(com.oracle.tck.lib.autd2.TestResult) ColorSpace(java.awt.color.ColorSpace) Operation(com.sun.tck.lib.tgf.data.Operation) TestGroup(com.sun.tck.test.TestGroup) RandomAccess(java.util.RandomAccess) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) TestCase(com.sun.tck.test.TestCase) DataFactory.createRow(com.sun.tck.lib.tgf.DataFactory.createRow) Transform(com.sun.tck.lib.tgf.Transform) ExpectedExceptions(com.sun.tck.lib.ExpectedExceptions) Values(com.sun.tck.lib.tgf.Values) Assert(org.junit.Assert) Assert.assertTrue(com.sun.tck.lib.Assert.assertTrue) DataFactory.createColumn(com.sun.tck.lib.tgf.DataFactory.createColumn) Assert.assertEquals(com.sun.tck.lib.Assert.assertEquals) 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)

Aggregations

TestGroup (com.sun.tck.test.TestGroup)55 Test (org.junit.Test)53 TestResult (com.oracle.tck.lib.autd2.TestResult)49 Values (com.sun.tck.lib.tgf.Values)27 TestedAPI (com.sun.tck.test.TestedAPI)10 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)10 TestData (com.sun.tck.lib.tgf.TestData)7 Color (java.awt.Color)7 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)4 DataFactory (com.sun.tck.lib.tgf.DataFactory)4 Longs (com.sun.tck.lib.tgf.data.Longs)3 ColorSpace (java.awt.color.ColorSpace)3 Iterator (java.util.Iterator)3 List (java.util.List)3 RandomAccess (java.util.RandomAccess)3 Collectors.toList (java.util.stream.Collectors.toList)3 Assert.assertEquals (com.sun.tck.lib.Assert.assertEquals)2 Assert.assertTrue (com.sun.tck.lib.Assert.assertTrue)2 ExpectedExceptions (com.sun.tck.lib.ExpectedExceptions)2 DataFactory.createColumn (com.sun.tck.lib.tgf.DataFactory.createColumn)2