--- old/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java 2016-01-25 22:56:08.882589032 -0800 +++ new/test/java/util/stream/bootlib/java.base/java/util/stream/StreamTestDataProvider.java 2016-01-25 22:56:08.644589015 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 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 @@ -39,7 +39,6 @@ private static final Integer[] to1 = new Integer[1]; private static final Integer[] to10 = new Integer[10]; private static final Integer[] to100 = new Integer[100]; - private static final Integer[] to1000 = new Integer[1000]; private static final Integer[] reversed = new Integer[100]; private static final Integer[] ones = new Integer[100]; private static final Integer[] twice = new Integer[200]; @@ -50,7 +49,7 @@ private static final Object[][] spliteratorTestData; static { - Integer[][] arrays = {to0, to1, to10, to100, to1000}; + Integer[][] arrays = {to0, to1, to10, to100}; for (Integer[] arr : arrays) { for (int i = 0; i < arr.length; i++) { arr[i] = i; @@ -75,7 +74,6 @@ {"0..1", to1}, {"0..10", to10}, {"0..100", to100}, - {"0..1000", to1000}, {"100x[1]", ones}, {"2x[0..100]", twice}, {"reverse 0..100", reversed}, --- old/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapOpTest.java 2016-01-25 22:56:09.622589084 -0800 +++ new/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapOpTest.java 2016-01-25 22:56:09.444589071 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, 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 @@ -24,7 +24,7 @@ /* * @test * @summary flat-map operations - * @bug 8044047 + * @bug 8044047 8076458 */ package org.openjdk.tests.java.util.stream; @@ -33,16 +33,12 @@ import java.util.Arrays; import java.util.Collection; -import java.util.Collections; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.DoubleStream; -import java.util.stream.DoubleStreamTestDataProvider; import java.util.stream.IntStream; -import java.util.stream.IntStreamTestDataProvider; import java.util.stream.LongStream; -import java.util.stream.LongStreamTestDataProvider; import java.util.stream.OpTestCase; import java.util.stream.Stream; import java.util.stream.StreamTestDataProvider; @@ -100,36 +96,6 @@ assertEquals(before.get(), onClose.get()); } - @Test - public void testIntClose() { - AtomicInteger before = new AtomicInteger(); - AtomicInteger onClose = new AtomicInteger(); - - IntStream.of(1, 2).peek(e -> before.getAndIncrement()). - flatMap(i -> IntStream.of(i, i).onClose(onClose::getAndIncrement)).count(); - assertEquals(before.get(), onClose.get()); - } - - @Test - public void testLongClose() { - AtomicInteger before = new AtomicInteger(); - AtomicInteger onClose = new AtomicInteger(); - - LongStream.of(1, 2).peek(e -> before.getAndIncrement()). - flatMap(i -> LongStream.of(i, i).onClose(onClose::getAndIncrement)).count(); - assertEquals(before.get(), onClose.get()); - } - - @Test - public void testDoubleClose() { - AtomicInteger before = new AtomicInteger(); - AtomicInteger onClose = new AtomicInteger(); - - DoubleStream.of(1, 2).peek(e -> before.getAndIncrement()). - flatMap(i -> DoubleStream.of(i, i).onClose(onClose::getAndIncrement)).count(); - assertEquals(before.get(), onClose.get()); - } - @Test(dataProvider = "StreamTestData", dataProviderClass = StreamTestDataProvider.class) public void testOps(String name, TestData.OfRef data) { Collection result = exerciseOps(data, s -> s.flatMap(mfId)); @@ -145,49 +111,4 @@ exerciseOps(data, s -> s.flatMap(integerRangeMapper)); exerciseOps(data, s -> s.flatMap((Integer e) -> IntStream.range(0, e).boxed().limit(10))); } - - // - - @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class) - public void testIntOps(String name, TestData.OfInt data) { - Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToInt(j -> j))); - assertEquals(data.size(), result.size()); - assertContents(data, result); - - result = exerciseOps(data, s -> s.flatMap(i -> IntStream.empty())); - assertEquals(0, result.size()); - - exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e))); - exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10))); - } - - // - - @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class) - public void testLongOps(String name, TestData.OfLong data) { - Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToLong(j -> j))); - assertEquals(data.size(), result.size()); - assertContents(data, result); - - result = exerciseOps(data, s -> LongStream.empty()); - assertEquals(0, result.size()); - - exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e))); - exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e).limit(10))); - } - - // - - @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class) - public void testDoubleOps(String name, TestData.OfDouble data) { - Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToDouble(j -> j))); - assertEquals(data.size(), result.size()); - assertContents(data, result); - - result = exerciseOps(data, s -> DoubleStream.empty()); - assertEquals(0, result.size()); - - exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).asDoubleStream())); - exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).limit(10).asDoubleStream())); - } } --- /dev/null 2016-01-26 02:57:03.214241146 -0800 +++ new/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapDoubleOpTest.java 2016-01-25 22:56:10.156589121 -0800 @@ -0,0 +1,71 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary flat-map operations + * @bug 8044047 8076458 + */ + +package org.openjdk.tests.java.util.stream; + +import org.testng.annotations.Test; + +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.DoubleStream; +import java.util.stream.DoubleStreamTestDataProvider; +import java.util.stream.IntStream; +import java.util.stream.OpTestCase; +import java.util.stream.TestData; + +import static java.util.stream.LambdaTestHelpers.*; +import static java.util.stream.ThowableHelper.checkNPE; + +@Test +public class FlatMapDoubleOpTest extends OpTestCase { + + @Test + public void testDoubleClose() { + AtomicInteger before = new AtomicInteger(); + AtomicInteger onClose = new AtomicInteger(); + + DoubleStream.of(1, 2).peek(e -> before.getAndIncrement()). + flatMap(i -> DoubleStream.of(i, i).onClose(onClose::getAndIncrement)).count(); + assertEquals(before.get(), onClose.get()); + } + + @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class) + public void testDoubleOps(String name, TestData.OfDouble data) { + Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToDouble(j -> j))); + assertEquals(data.size(), result.size()); + assertContents(data, result); + + result = exerciseOps(data, s -> DoubleStream.empty()); + assertEquals(0, result.size()); + + exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).asDoubleStream())); + exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, (int) e).limit(10).asDoubleStream())); + } +} --- /dev/null 2016-01-26 02:57:03.214241146 -0800 +++ new/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapIntOpTest.java 2016-01-25 22:56:11.376589207 -0800 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary flat-map operations + * @bug 8044047 8076458 + */ + +package org.openjdk.tests.java.util.stream; + +import org.testng.annotations.Test; + +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.IntStream; +import java.util.stream.IntStreamTestDataProvider; +import java.util.stream.OpTestCase; +import java.util.stream.TestData; + +import static java.util.stream.LambdaTestHelpers.*; + +@Test +public class FlatMapIntOpTest extends OpTestCase { + + @Test + public void testIntClose() { + AtomicInteger before = new AtomicInteger(); + AtomicInteger onClose = new AtomicInteger(); + + IntStream.of(1, 2).peek(e -> before.getAndIncrement()). + flatMap(i -> IntStream.of(i, i).onClose(onClose::getAndIncrement)).count(); + assertEquals(before.get(), onClose.get()); + } + + @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class) + public void testIntOps(String name, TestData.OfInt data) { + Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToInt(j -> j))); + assertEquals(data.size(), result.size()); + assertContents(data, result); + + result = exerciseOps(data, s -> s.flatMap(i -> IntStream.empty())); + assertEquals(0, result.size()); + + exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e))); + exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10))); + } +} --- /dev/null 2016-01-26 02:57:03.214241146 -0800 +++ new/test/java/util/stream/test/org/openjdk/tests/java/util/stream/FlatMapLongOpTest.java 2016-01-25 22:56:12.274589270 -0800 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 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. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary flat-map operations + * @bug 8044047 8076458 + */ + +package org.openjdk.tests.java.util.stream; + +import org.testng.annotations.Test; + +import java.util.Collection; +import java.util.Collections; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.LongStream; +import java.util.stream.LongStreamTestDataProvider; +import java.util.stream.OpTestCase; +import java.util.stream.TestData; + +import static java.util.stream.LambdaTestHelpers.*; + +@Test +public class FlatMapLongOpTest extends OpTestCase { + + @Test + public void testLongClose() { + AtomicInteger before = new AtomicInteger(); + AtomicInteger onClose = new AtomicInteger(); + + LongStream.of(1, 2).peek(e -> before.getAndIncrement()). + flatMap(i -> LongStream.of(i, i).onClose(onClose::getAndIncrement)).count(); + assertEquals(before.get(), onClose.get()); + } + + @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class) + public void testLongOps(String name, TestData.OfLong data) { + Collection result = exerciseOps(data, s -> s.flatMap(i -> Collections.singleton(i).stream().mapToLong(j -> j))); + assertEquals(data.size(), result.size()); + assertContents(data, result); + + result = exerciseOps(data, s -> LongStream.empty()); + assertEquals(0, result.size()); + + exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e))); + exerciseOps(data, s -> s.flatMap(e -> LongStream.range(0, e).limit(10))); + } +}