< prev index next >
test/java/util/stream/bootlib/java.base/java/util/stream/DoubleStreamTestDataProvider.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2013, 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.
--- 1,7 ----
/*
! * Copyright (c) 2013, 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,48 ****
--- 39,49 ----
private static final double[] ones = new double[100];
private static final double[] twice = new double[200];
private static final double[] pseudoRandom;
private static final Object[][] testData;
+ private static final Object[][] testSmallData;
private static final Object[][] spliteratorTestData;
static {
double[][] arrays = {to0, to1, to10, to100, to1000};
for (double[] arr : arrays) {
*** 76,101 ****
{"pseudorandom", pseudoRandom}
};
static {
{
! List<Object[]> list = new ArrayList<>();
for (Object[] data : arrays) {
final Object name = data[0];
final double[] doubles = (double[]) data[1];
list.add(new Object[]{"array:" + name,
TestData.Factory.ofArray("array:" + name, doubles)});
SpinedBuffer.OfDouble isl = new SpinedBuffer.OfDouble();
for (double i : doubles) {
isl.accept(i);
}
list.add(new Object[]{"SpinedList:" + name,
TestData.Factory.ofSpinedBuffer("SpinedList:" + name, isl)});
}
! testData = list.toArray(new Object[0][]);
}
{
List<Object[]> spliterators = new ArrayList<>();
for (Object[] data : arrays) {
--- 77,108 ----
{"pseudorandom", pseudoRandom}
};
static {
{
! List<Object[]> listSmall = new ArrayList<>();
! List<Object[]> list1000 = new ArrayList<>();
! List<Object[]> list = null;
for (Object[] data : arrays) {
final Object name = data[0];
final double[] doubles = (double[]) data[1];
+ list = doubles.length >= 1000 ? list1000 : listSmall;
+
list.add(new Object[]{"array:" + name,
TestData.Factory.ofArray("array:" + name, doubles)});
SpinedBuffer.OfDouble isl = new SpinedBuffer.OfDouble();
for (double i : doubles) {
isl.accept(i);
}
list.add(new Object[]{"SpinedList:" + name,
TestData.Factory.ofSpinedBuffer("SpinedList:" + name, isl)});
}
! testSmallData = listSmall.toArray(new Object[0][]);
! list1000.addAll(listSmall);
! testData = list1000.toArray(new Object[0][]);
}
{
List<Object[]> spliterators = new ArrayList<>();
for (Object[] data : arrays) {
*** 134,143 ****
--- 141,155 ----
@DataProvider(name = "DoubleStreamTestData")
public static Object[][] makeDoubleStreamTestData() {
return testData;
}
+ @DataProvider(name = "DoubleStreamTestData.small")
+ public static Object[][] makeSmallDoubleStreamTestData() {
+ return testSmallData;
+ }
+
// returns an array of (String name, Supplier<PrimitiveSpliterator<Double>>)
@DataProvider(name = "DoubleSpliterator")
public static Object[][] spliteratorProvider() {
return spliteratorTestData;
}
< prev index next >