Search in sources :

Example 51 with TestData

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

the class DataQueriesFromFields method test_1.

@org.junit.Test
public void test_1() {
    final Set<Integer> set = new HashSet<Integer>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        private ValuesHolder holder = new ValuesHolder();

        @TestCase
        @TestData("holder.setup")
        public void test(int i) throws Throwable {
            set.add(i);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(1));
    Assert.assertTrue(set.contains(3));
    Assert.assertTrue(set.contains(7));
    Assert.assertTrue(set.contains(9));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) HashSet(java.util.HashSet)

Example 52 with TestData

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

the class DataQueriesFromFields method test_3.

@org.junit.Test
public void test_3() {
    final Set<Integer> set = new HashSet<Integer>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        private ValuesHolder3 holder3 = new ValuesHolder3();

        @TestCase
        @TestData("holder3.holder2.holder.setup")
        public void test(int i) throws Throwable {
            set.add(i);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(1));
    Assert.assertTrue(set.contains(3));
    Assert.assertTrue(set.contains(7));
    Assert.assertTrue(set.contains(9));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) HashSet(java.util.HashSet)

Example 53 with TestData

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

the class InlinedArgData_ManyArgs method intString_1_old.

@org.junit.Test
public void intString_1_old() {
    final List<Integer> ints = new ArrayList<Integer>();
    final List<String> strings = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() {

        Values data = DataFactory.createColumn(1, 2, 3).pseudoMultiply("a", "b");

        @TestCase
        @TestData("data")
        public void test(int i, String s) {
            ints.add(i);
            strings.add(s);
            System.out.println(MessageFormat.format("i = {0}, s = {1}", i, s));
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(3, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(2, ints.get(1), 0.0);
    Assert.assertEquals(3, ints.get(2), 0.0);
    Assert.assertEquals(3, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Example 54 with TestData

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

the class IteratorAsSupportedDataContainer method test_04_IteratorOfIntegers_2.

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

        Iterator<Integer> component = IntStream.range(55, 98).iterator();

        int counter;

        @TestCase
        public void test(@TestData("component") int r) {
            counter++;
        }
    }
    Test tg = new Test();
    com.oracle.tck.lib.autd2.TestResult s = TU.runTestGroup(tg);
    Assert.assertTrue(s.isOK());
    Assert.assertEquals(43, tg.counter);
    Assert.assertEquals("test cases: 1; all passed", s.getMessage());
}
Also used : TestData(com.sun.tck.lib.tgf.TestData) Test(org.junit.Test) Iterator(java.util.Iterator) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) TestGroup(com.sun.tck.test.TestGroup) Test(org.junit.Test)

Example 55 with TestData

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

the class IteratorAsSupportedDataContainer method iteratorAsReturnType_mix.

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

        Iterator<Object[]> mixIterator = Arrays.<Object[]>asList(new Object[] { 89898, 176253, "123" }, new Object[] { 34324, 343424, "345" }).iterator();

        @TestCase
        @TestData("mixIterator")
        public void test(int i, int j, String s) throws Throwable {
            is.add(i);
            js.add(j);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(2, is.size());
    Assert.assertEquals(2, js.size());
    Assert.assertEquals(2, strings.size());
    Assert.assertEquals(89898, (int) is.get(0));
    Assert.assertEquals(176253, (int) js.get(0));
    Assert.assertEquals("123", strings.get(0));
    Assert.assertEquals(34324, (int) is.get(1));
    Assert.assertEquals(343424, (int) js.get(1));
    Assert.assertEquals("345", strings.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) Test(org.junit.Test)

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