Search in sources :

Example 26 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_long.

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

        long[] longs = { Long.MIN_VALUE, Long.MAX_VALUE, 523400023467l, 23424234332424l };

        @TestCase
        public void test(@TestData("longs") long l) throws Throwable {
            set.add(l);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(Long.MIN_VALUE));
    Assert.assertTrue(set.contains(Long.MAX_VALUE));
    Assert.assertTrue(set.contains(523400023467l));
    Assert.assertTrue(set.contains(23424234332424l));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 27 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_double.

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

        double[] doubles = { 0., 3.4, 67.3456, Double.MAX_VALUE };

        @TestCase
        public void test(@TestData("doubles") double d) throws Throwable {
            set.add(d);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(4, set.size());
    Assert.assertTrue(set.contains(0.));
    Assert.assertTrue(set.contains(3.4));
    Assert.assertTrue(set.contains(67.3456));
    Assert.assertTrue(set.contains(Double.MAX_VALUE));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 28 with BaseTestGroup

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

the class ArraysOfPrimitives method arrayAsReturnType_byte.

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

        byte[] bytes = { 0, 1, 120, 45, 8 };

        @TestCase
        public void test(@TestData("bytes") byte b) throws Throwable {
            set.add(b);
        }
    }, TU.EMPTY_ARGV);
    Assert.assertTrue(status.isOK());
    Assert.assertEquals(5, set.size());
    Assert.assertTrue(set.contains((byte) 0));
    Assert.assertTrue(set.contains((byte) 1));
    Assert.assertTrue(set.contains((byte) 120));
    Assert.assertTrue(set.contains((byte) 45));
    Assert.assertTrue(set.contains((byte) 8));
}
Also used : TestCase(com.sun.tck.test.TestCase) BaseTestGroup(com.oracle.tck.lib.autd2.unittests.BaseTestGroup) HashSet(java.util.HashSet)

Example 29 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup 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 30 with BaseTestGroup

use of com.oracle.tck.lib.autd2.unittests.BaseTestGroup 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)

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