Search in sources :

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

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

the class Examples method test_09.

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

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

        @TestCase
        @TestData("multiplyValues")
        public void testToString(Comparable<?> a, Comparable<?> b) {
        }
    }
    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 37 with com.oracle.tck.lib.autd2

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

the class Examples method test_10_01.

@Test
public void test_10_01() {
    @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(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 38 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_04.

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

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

        @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) DataFactory(com.sun.tck.lib.tgf.DataFactory) TestResult(com.oracle.tck.lib.autd2.TestResult) Test(org.junit.Test)

Example 39 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_2_01.

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

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

            @Transform
            Values t(Color[] colors) {
                if (colors.length > 0) {
                    return createRow(colors[0].getBlue());
                } else {
                    return null;
                }
            }
        });

        @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 40 with com.oracle.tck.lib.autd2

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

the class Examples method test_03.

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

        Values colors = createColumn(BLUE, BLACK, WHITE).<Color>filter(c -> createRow(c.darker(), c.brighter()));

        @TestCase
        @TestData("colors")
        public void test(Color darker, Color brighter) {
            assertTrue(darker.getRed() <= brighter.getRed());
            assertTrue(darker.getGreen() <= brighter.getGreen());
            assertTrue(darker.getBlue() <= brighter.getBlue());
        }
    }
    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

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