Search in sources :

Example 21 with TestData

use of com.sun.tck.lib.tgf.TestData 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)

Example 22 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_shorts_special_case.

@org.junit.Test
public void arrayAsReturnType_shorts_special_case() {
    final List<Short> is = new ArrayList<Short>();
    final List<Short> js = new ArrayList<Short>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        short[][] shorts = { { 23234, 23400 } };

        @TestCase
        @TestData("shorts")
        public void test(short i, short j) throws Throwable {
            is.add(i);
            js.add(j);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(1, is.size());
    Assert.assertEquals(1, js.size());
    Assert.assertEquals(23234, (short) is.get(0));
    Assert.assertEquals(23400, (short) js.get(0));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 23 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_bytes_special_case_1.

@org.junit.Test
public void arrayAsReturnType_bytes_special_case_1() {
    final List<Byte> is = new ArrayList<Byte>();
    final List<Byte> js = new ArrayList<Byte>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        byte[][] bytes = { { 34, 12 }, { 89, 29 } };

        @TestCase
        @TestData("bytes")
        public void test(byte i, byte j) throws Throwable {
            is.add(i);
            js.add(j);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(2, is.size());
    Assert.assertEquals(2, js.size());
    Assert.assertEquals(34, (byte) is.get(0));
    Assert.assertEquals(12, (byte) js.get(0));
    Assert.assertEquals(89, (byte) is.get(1));
    Assert.assertEquals(29, (byte) js.get(1));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 24 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_doubles_special_case.

@org.junit.Test
public void arrayAsReturnType_doubles_special_case() {
    final List<Double> is = new ArrayList<Double>();
    final List<Double> js = new ArrayList<Double>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        double[][] doubles = { { 3.96786, 8678.18 } };

        @TestCase
        @TestData("doubles")
        public void test(double i, double j) throws Throwable {
            is.add(i);
            js.add(j);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(1, is.size());
    Assert.assertEquals(1, js.size());
    Assert.assertEquals(3.96786, (double) is.get(0), 0.0001);
    Assert.assertEquals(8678.18, (double) js.get(0), 0.0001);
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Example 25 with TestData

use of com.sun.tck.lib.tgf.TestData in project jtharness by openjdk.

the class ArraysOfPrimitives method arrayAsReturnType_bytes_special_case.

@org.junit.Test
public void arrayAsReturnType_bytes_special_case() {
    final List<Byte> is = new ArrayList<Byte>();
    final List<Byte> js = new ArrayList<Byte>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        byte[][] bytes = { { 3, 18 } };

        @TestCase
        @TestData("bytes")
        public void test(byte i, byte j) throws Throwable {
            is.add(i);
            js.add(j);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(1, is.size());
    Assert.assertEquals(1, js.size());
    Assert.assertEquals(3, (byte) is.get(0));
    Assert.assertEquals(18, (byte) js.get(0));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase)

Aggregations

TestData (com.sun.tck.lib.tgf.TestData)64 TestCase (com.sun.tck.test.TestCase)57 BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)50 Test (org.junit.Test)37 ArrayList (java.util.ArrayList)30 Values (com.sun.tck.lib.tgf.Values)22 TestResult (com.oracle.tck.lib.autd2.TestResult)14 TestGroup (com.sun.tck.test.TestGroup)7 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)5 HashSet (java.util.HashSet)5 Color (java.awt.Color)4 List (java.util.List)4 ColorSpace (java.awt.color.ColorSpace)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 (com.sun.tck.lib.tgf.DataFactory)2 DataFactory.createColumn (com.sun.tck.lib.tgf.DataFactory.createColumn)2 DataFactory.createRow (com.sun.tck.lib.tgf.DataFactory.createRow)2