Search in sources :

Example 1 with TestGroup

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

the class Examples method test_10.

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

        int calls;

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { {}, { 3, 4 } }).filter((Comparable<?>[] objectsToUse) -> {
            calls++;
            return DataFactory.createRow((Object[]) objectsToUse);
        });

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Comparable<?> a, Comparable<?> b) {
            System.out.println("TestTransformingIterator.testToString");
        }
    }
    TestTransformingIterator tg = new TestTransformingIterator();
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
    Assert.assertTrue(s.isOK());
    Assert.assertEquals(2, tg.calls);
    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 2 with TestGroup

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

the class Examples method test_03_array_01.

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

        Values quantities = createColumn(new Color[] { BLUE }, new Color[] { BLACK }, new Color[] { BLUE, YELLOW }, new Color[] { RED }).filter((Color[] 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 : 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 3 with TestGroup

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

the class Examples method test_11.

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

        int calls;

        Values multiplyValues = DataFactory.createValues(new Comparable<?>[][] { {}, { 3, 4 } }).filter((Object objectsToUse) -> {
            calls++;
            return DataFactory.createRow(objectsToUse);
        });

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Object a) {
            System.out.println("TestTransformingIterator.testToString");
        }
    }
    TestTransformingIterator tg = new TestTransformingIterator();
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
    Assert.assertTrue(s.isOK());
    Assert.assertEquals(2, tg.calls);
    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 4 with TestGroup

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

the class Examples method test_03_array_01_old_approach_2.

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

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

            @Transform
            Values t(Color[] colors) {
                return createRow(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 5 with TestGroup

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

the class Examples method test_04.

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

        List<Integer> component = IntStream.range(55, 99).boxed().collect(toList());

        int counter = 0;

        @TestCase
        @Operation(MULTIPLY)
        public void test(@TestData("component") int r, @TestData("component") int g, @TestData("component") int b) {
            Color color = new Color(r, g, b);
            assertEquals(r, color.getRed());
            assertEquals(g, color.getGreen());
            assertEquals(b, color.getBlue());
            counter++;
        }
    }
    Test tg = new Test();
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
    Assert.assertTrue(s.isOK());
    Assert.assertEquals(85184, tg.counter);
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) Test(org.junit.Test) Color(java.awt.Color) TestGroup(com.sun.tck.test.TestGroup) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) 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