Search in sources :

Example 1 with Operation

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

the class InlinedArgData_ManyArgs method intString_mult_3.

@org.junit.Test
public void intString_mult_3() {
    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() {

        List<Integer> intsData = Arrays.asList(1, 2, 3);

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("intsData") int i, @Strings({ "a", "b" }) String s) {
            ints.add(i);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(1, ints.get(1), 0.0);
    Assert.assertEquals(2, ints.get(2), 0.0);
    Assert.assertEquals(2, ints.get(3), 0.0);
    Assert.assertEquals(3, ints.get(4), 0.0);
    Assert.assertEquals(3, ints.get(5), 0.0);
    Assert.assertEquals(6, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
    Assert.assertEquals("b", strings.get(3));
    Assert.assertEquals("a", strings.get(4));
    Assert.assertEquals("b", strings.get(5));
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Example 2 with Operation

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

the class InlinedArgData_ManyArgs method intString_mult_1.

@org.junit.Test
public void intString_mult_1() {
    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() {

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@Ints({ 1, 2, 3 }) int i, @Strings({ "a", "b" }) String s) {
            ints.add(i);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(1, ints.get(1), 0.0);
    Assert.assertEquals(2, ints.get(2), 0.0);
    Assert.assertEquals(2, ints.get(3), 0.0);
    Assert.assertEquals(3, ints.get(4), 0.0);
    Assert.assertEquals(3, ints.get(5), 0.0);
    Assert.assertEquals(6, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
    Assert.assertEquals("b", strings.get(3));
    Assert.assertEquals("a", strings.get(4));
    Assert.assertEquals("b", strings.get(5));
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Example 3 with Operation

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

the class ReferenceAttachedToParam method mixed_mult_3.

@org.junit.Test
public void mixed_mult_3() {
    final List<Class<?>> list_1 = new ArrayList<Class<?>>();
    final List<String> list_2 = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        private Values classes_ = DataFactory.createColumn(String.class, Throwable.class);

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("classes_") Class<?> c, @Strings({ "x", "y", "z" }) String s) throws Throwable {
            list_1.add(c);
            list_2.add(s);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, list_1.size());
    Assert.assertEquals(6, list_2.size());
    Assert.assertEquals(String.class, list_1.get(0));
    Assert.assertEquals(String.class, list_1.get(1));
    Assert.assertEquals(String.class, list_1.get(2));
    Assert.assertEquals(Throwable.class, list_1.get(3));
    Assert.assertEquals(Throwable.class, list_1.get(4));
    Assert.assertEquals(Throwable.class, list_1.get(5));
    Assert.assertEquals("x", list_2.get(0));
    Assert.assertEquals("y", list_2.get(1));
    Assert.assertEquals("z", list_2.get(2));
    Assert.assertEquals("x", list_2.get(3));
    Assert.assertEquals("y", list_2.get(4));
    Assert.assertEquals("z", list_2.get(5));
}
Also used : ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase)

Example 4 with Operation

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

the class ReferenceAttachedToParam method mixed_mult_2.

@org.junit.Test
public void mixed_mult_2() {
    final List<Class<?>> list_1 = new ArrayList<Class<?>>();
    final List<String> list_2 = new ArrayList<String>();
    com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new BaseTestGroup() {

        Values strings_ = DataFactory.createColumn("aa", "bb", "cc");

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@Classes({ String.class, Throwable.class }) Class<?> c, @TestData("strings_") String s) throws Throwable {
            list_1.add(c);
            list_2.add(s);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, list_1.size());
    Assert.assertEquals(6, list_2.size());
    Assert.assertEquals(String.class, list_1.get(0));
    Assert.assertEquals(String.class, list_1.get(1));
    Assert.assertEquals(String.class, list_1.get(2));
    Assert.assertEquals(Throwable.class, list_1.get(3));
    Assert.assertEquals(Throwable.class, list_1.get(4));
    Assert.assertEquals(Throwable.class, list_1.get(5));
    Assert.assertEquals("aa", list_2.get(0));
    Assert.assertEquals("bb", list_2.get(1));
    Assert.assertEquals("cc", list_2.get(2));
    Assert.assertEquals("aa", list_2.get(3));
    Assert.assertEquals("bb", list_2.get(4));
    Assert.assertEquals("cc", list_2.get(5));
}
Also used : ArrayList(java.util.ArrayList) Values(com.sun.tck.lib.tgf.Values) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase)

Example 5 with Operation

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

the class InlinedArgData_ManyArgs method intString_mult_4.

@org.junit.Test
public void intString_mult_4() {
    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() {

        List<Integer> intsData = Arrays.asList(1, 2, 3);

        String[] stringsData = { "a", "b" };

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("intsData") int i, @TestData("stringsData") String s) {
            ints.add(i);
            strings.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(6, ints.size());
    Assert.assertEquals(1, ints.get(0), 0.0);
    Assert.assertEquals(1, ints.get(1), 0.0);
    Assert.assertEquals(2, ints.get(2), 0.0);
    Assert.assertEquals(2, ints.get(3), 0.0);
    Assert.assertEquals(3, ints.get(4), 0.0);
    Assert.assertEquals(3, ints.get(5), 0.0);
    Assert.assertEquals(6, strings.size());
    Assert.assertEquals("a", strings.get(0));
    Assert.assertEquals("b", strings.get(1));
    Assert.assertEquals("a", strings.get(2));
    Assert.assertEquals("b", strings.get(3));
    Assert.assertEquals("a", strings.get(4));
    Assert.assertEquals("b", strings.get(5));
}
Also used : ArrayList(java.util.ArrayList) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) Operation(com.sun.tck.lib.tgf.data.Operation) TestCase(com.sun.tck.test.TestCase) Test(org.junit.Test)

Aggregations

BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)8 Operation (com.sun.tck.lib.tgf.data.Operation)8 TestCase (com.sun.tck.test.TestCase)8 ArrayList (java.util.ArrayList)8 Values (com.sun.tck.lib.tgf.Values)4 Test (org.junit.Test)4 List (java.util.List)1