< prev index next >

test/java/util/stream/bootlib/java.base/java/util/stream/IntStreamTestDataProvider.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -39,10 +39,11 @@
     private static final int[] ones = new int[100];
     private static final int[] twice = new int[200];
     private static final int[] pseudoRandom;
 
     private static final Object[][] testData;
+    private static final Object[][] testSmallData;
     private static final Object[][] spliteratorTestData;
 
     static {
         int[][] arrays = {to0, to1, to10, to100, to1000};
         for (int[] arr : arrays) {

@@ -76,15 +77,19 @@
             {"pseudorandom", pseudoRandom}
     };
 
     static {
         {
-            List<Object[]> list = new ArrayList<>();
+            List<Object[]> listSmall = new ArrayList<>();
+            List<Object[]> list1000 = new ArrayList<>();
+            List<Object[]> list = null;
             for (Object[] data : arrays) {
                 final Object name = data[0];
                 final int[] ints = (int[]) data[1];
 
+                list = ints.length >= 1000 ? list1000 : listSmall;
+
                 list.add(new Object[]{"array:" +
                                       name, TestData.Factory.ofArray("array:" + name, ints)});
 
                 SpinedBuffer.OfInt isl = new SpinedBuffer.OfInt();
                 for (int i : ints) {

@@ -96,11 +101,13 @@
                 list.add(streamDataDescr("IntStream.intRange(0,l): " + ints.length,
                                          () -> IntStream.range(0, ints.length)));
                 list.add(streamDataDescr("IntStream.rangeClosed(0,l): " + ints.length,
                                          () -> IntStream.rangeClosed(0, ints.length)));
             }
-            testData = list.toArray(new Object[0][]);
+            testSmallData = listSmall.toArray(new Object[0][]);
+            list1000.addAll(listSmall);
+            testData = list1000.toArray(new Object[0][]);
         }
 
         {
             List<Object[]> spliterators = new ArrayList<>();
             for (Object[] data : arrays) {

@@ -148,10 +155,15 @@
     @DataProvider(name = "IntStreamTestData")
     public static Object[][] makeIntStreamTestData() {
         return testData;
     }
 
+    @DataProvider(name = "IntStreamTestData.small")
+    public static Object[][] makeSmallIntStreamTestData() {
+        return testSmallData;
+    }
+
     // returns an array of (String name, Supplier<PrimitiveSpliterator<Integer>>)
     @DataProvider(name = "IntSpliterator")
     public static Object[][] spliteratorProvider() {
         return spliteratorTestData;
     }
< prev index next >