Search in sources :

Example 91 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_longs_special_case_1.

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

        long[][] longs = { { 234l, 234245435l }, { 89000004l, 2345234573450l } };

        @TestCase
        @TestData("longs")
        public void test(long i, long 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(234l, (long) is.get(0));
    Assert.assertEquals(234245435l, (long) js.get(0));
    Assert.assertEquals(89000004l, (long) is.get(1));
    Assert.assertEquals(2345234573450l, (long) 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 92 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_booleans.

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

        boolean[] booleans = { true, false };

        @TestCase
        public void test(@TestData("booleans") boolean b) throws Throwable {
            set.add(b);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(2, set.size());
    Assert.assertTrue(set.contains(true));
    Assert.assertTrue(set.contains(false));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 93 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_ints.

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

        int[] ints = { 1, 23, 7, 9 };

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

Example 94 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_float.

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

        float[] floats = { 0.787878f, 73.f, 48324.234f, Float.MIN_VALUE };

        @TestCase
        public void test(@TestData("floats") float f) throws Throwable {
            set.add(f);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(0.787878f));
    Assert.assertTrue(set.contains(73.f));
    Assert.assertTrue(set.contains(48324.234f));
    Assert.assertTrue(set.contains(Float.MIN_VALUE));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 95 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_short.

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

        short[] shorts = { Short.MIN_VALUE, (short) 938576, (short) 23487, (short) 809, (short) 43 };

        @TestCase
        public void test(@TestData("shorts") short s) throws Throwable {
            set.add(s);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(5, set.size());
    Assert.assertTrue(set.contains(Short.MIN_VALUE));
    Assert.assertTrue(set.contains((short) 938576));
    Assert.assertTrue(set.contains((short) 23487));
    Assert.assertTrue(set.contains((short) 809));
    Assert.assertTrue(set.contains((short) 43));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Aggregations

BaseTestGroup (com.oracle.tck.lib.autd2.unittests.BaseTestGroup)132 TestCase (com.sun.tck.test.TestCase)126 ArrayList (java.util.ArrayList)73 Test (org.junit.Test)62 TestData (com.sun.tck.lib.tgf.TestData)47 Values (com.sun.tck.lib.tgf.Values)21 HashSet (java.util.HashSet)13 DataFactory.createValues (com.sun.tck.lib.tgf.DataFactory.createValues)12 NonTestCase (com.oracle.tck.lib.autd2.NonTestCase)11 TestResult (com.oracle.tck.lib.autd2.TestResult)11 TestObject (com.oracle.tck.lib.autd2.unittests.TestObject)9 Operation (com.sun.tck.lib.tgf.data.Operation)8 java.util (java.util)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 List (java.util.List)2 com.oracle.tck.lib.autd2 (com.oracle.tck.lib.autd2)1 CustomException (com.oracle.tck.lib.autd2.unittests.CustomException)1 TU (com.oracle.tck.lib.autd2.unittests.TU)1 ValuesComparison (com.oracle.tck.lib.autd2.unittests.ValuesComparison)1 com.sun.tck.lib.tgf (com.sun.tck.lib.tgf)1