Search in sources :

Example 6 with Operation

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

the class InlinedArgData_ManyArgs method intString_mult_2.

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

        private List<Integer> ints() {
            return Arrays.asList(1, 2, 3);
        }

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("ints") 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) ArrayList(java.util.ArrayList) List(java.util.List) Test(org.junit.Test)

Example 7 with Operation

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

the class ReferenceAttachedToParam method mixed_mult_1.

@org.junit.Test
public void mixed_mult_1() {
    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("a", "b", "c");

        Class<?>[] classes = { String.class, Throwable.class };

        @TestCase
        @Operation(Operation.TYPE.MULTIPLY)
        public void test(@TestData("classes") 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("a", list_2.get(0));
    Assert.assertEquals("b", list_2.get(1));
    Assert.assertEquals("c", list_2.get(2));
    Assert.assertEquals("a", list_2.get(3));
    Assert.assertEquals("b", list_2.get(4));
    Assert.assertEquals("c", 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 8 with Operation

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

the class ReferenceAttachedToParam method mixed_pseudomult.

@org.junit.Test
public void mixed_pseudomult() {
    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("a", "b", "c");

        Class<?>[] classes = { String.class, Throwable.class };

        @TestCase
        @Operation(Operation.TYPE.PSEUDOMULTYPLY)
        public void test(@TestData("classes") Class<?> c, @TestData("strings_") String s) throws Throwable {
            list_1.add(c);
            list_2.add(s);
        }
    });
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(3, list_1.size());
    Assert.assertEquals(3, list_2.size());
    Assert.assertEquals(String.class, list_1.get(0));
    Assert.assertEquals(Throwable.class, list_1.get(1));
    Assert.assertEquals(String.class, list_1.get(2));
    Assert.assertEquals("a", list_2.get(0));
    Assert.assertEquals("b", list_2.get(1));
    Assert.assertEquals("c", list_2.get(2));
}
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)

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