changeset 7132:71ac5fd51ad6

Primitive tests for findFirst, findAny, min, max and tee.
author psandoz
date Mon, 21 Jan 2013 18:11:03 +0100
parents 31fea8a84b52
children 07eee37c8501
files test-ng/bootlib/java/util/stream/DoubleStreamTestData.java test-ng/bootlib/java/util/stream/IntStreamTestData.java test-ng/bootlib/java/util/stream/LambdaTestHelpers.java test-ng/bootlib/java/util/stream/LongStreamTestData.java test-ng/tests/org/openjdk/tests/java/util/stream/FindAnyOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/FindFirstOpTest.java test-ng/tests/org/openjdk/tests/java/util/stream/IntMinMaxTest.java test-ng/tests/org/openjdk/tests/java/util/stream/MinMaxByTest.java test-ng/tests/org/openjdk/tests/java/util/stream/MinMaxTest.java test-ng/tests/org/openjdk/tests/java/util/stream/TeeOpTest.java
diffstat 10 files changed, 317 insertions(+), 163 deletions(-) [+]
line wrap: on
line diff
--- a/test-ng/bootlib/java/util/stream/DoubleStreamTestData.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/bootlib/java/util/stream/DoubleStreamTestData.java	Mon Jan 21 18:11:03 2013 +0100
@@ -25,6 +25,7 @@
 package java.util.stream;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.PrimitiveIterator;
 import java.util.Spliterator;
 import java.util.function.IntSupplier;
@@ -40,6 +41,17 @@
         return StreamShape.DOUBLE_VALUE;
     }
 
+    @Override
+    public abstract PrimitiveIterator<Double> iterator();
+
+    @Override
+    public <A extends Collection<? super Double>> A into(A target) {
+        PrimitiveIterator<Double> iterator = iterator();
+        while (iterator.hasNext())
+            target.add(iterator.nextDouble());
+        return target;
+    }
+
     public static class ArrayData extends DoubleStreamTestData {
         private final String name;
         private final double[] array;
--- a/test-ng/bootlib/java/util/stream/IntStreamTestData.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/bootlib/java/util/stream/IntStreamTestData.java	Mon Jan 21 18:11:03 2013 +0100
@@ -24,9 +24,7 @@
  */
 package java.util.stream;
 
-import java.util.Arrays;
-import java.util.PrimitiveIterator;
-import java.util.Spliterator;
+import java.util.*;
 import java.util.function.IntSupplier;
 import java.util.function.Supplier;
 
@@ -40,6 +38,17 @@
         return StreamShape.INT_VALUE;
     }
 
+    @Override
+    public abstract PrimitiveIterator<Integer> iterator();
+
+    @Override
+    public <A extends Collection<? super Integer>> A into(A target) {
+        PrimitiveIterator<Integer> iterator = iterator();
+        while (iterator.hasNext())
+            target.add(iterator.nextInt());
+        return target;
+    }
+
     public static class ArrayData extends IntStreamTestData {
         private final String name;
         private final int[] array;
--- a/test-ng/bootlib/java/util/stream/LambdaTestHelpers.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/bootlib/java/util/stream/LambdaTestHelpers.java	Mon Jan 21 18:11:03 2013 +0100
@@ -63,6 +63,14 @@
     public static final IntPredicate ipTrue = x -> true;
     public static final IntPredicate ipEven = x -> 0 == x % 2;
     public static final IntPredicate ipOdd = x -> 1 == x % 2;
+    public static final LongPredicate lpFalse = x -> false;
+    public static final LongPredicate lpTrue = x -> true;
+    public static final LongPredicate lpEven = x -> 0 == x % 2;
+    public static final LongPredicate lpOdd = x -> 1 == x % 2;
+    public static final DoublePredicate dpFalse = x -> false;
+    public static final DoublePredicate dpTrue = x -> true;
+    public static final DoublePredicate dpEven = x -> 0 == ((long) x) % 2;
+    public static final DoublePredicate dpOdd = x -> 1 == ((long) x) % 2;
     public static final BinaryOperator<Integer> rPlus = (x, y) -> x+y;
     public static final BinaryOperator<Integer> rMax = (x, y) -> Math.max(x, y);
     public static final BinaryOperator<Integer> rMin = (x, y) -> Math.min(x,y);
--- a/test-ng/bootlib/java/util/stream/LongStreamTestData.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/bootlib/java/util/stream/LongStreamTestData.java	Mon Jan 21 18:11:03 2013 +0100
@@ -25,6 +25,7 @@
 package java.util.stream;
 
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.PrimitiveIterator;
 import java.util.Spliterator;
 import java.util.function.IntSupplier;
@@ -40,6 +41,17 @@
         return StreamShape.LONG_VALUE;
     }
 
+    @Override
+    public abstract PrimitiveIterator<Long> iterator();
+
+    @Override
+    public <A extends Collection<? super Long>> A into(A target) {
+        PrimitiveIterator<Long> iterator = iterator();
+        while (iterator.hasNext())
+            target.add(iterator.nextLong());
+        return target;
+    }
+
     public static class ArrayData extends LongStreamTestData {
         private final String name;
         private final long[] array;
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/FindAnyOpTest.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/FindAnyOpTest.java	Mon Jan 21 18:11:03 2013 +0100
@@ -24,23 +24,13 @@
  */
 package org.openjdk.tests.java.util.stream;
 
-import java.util.stream.OpTestCase;
-import java.util.stream.StreamTestData;
-import java.util.stream.StreamTestDataProvider;
-import java.util.stream.IntStreamTestData;
-import java.util.stream.IntStreamTestDataProvider;
+import java.util.*;
+import java.util.stream.*;
+
 import org.testng.annotations.Test;
 
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Objects;
-import java.util.Optional;
 import java.util.function.BiBlock;
 import java.util.function.Function;
-import java.util.stream.Stream;
-import java.util.OptionalInt;
-import java.util.stream.IntStream;
-import java.util.PrimitiveIterator;
 
 import static java.util.stream.LambdaTestHelpers.*;
 
@@ -67,17 +57,18 @@
     public void testStream(String name, StreamTestData<Integer> data) {
         exerciseStream(data, s -> s);
         exerciseStream(data, s -> s.filter(pTrue));
+        exerciseStream(data, s -> s.filter(pFalse));
         exerciseStream(data, s -> s.filter(pEven));
     }
 
     void exerciseStream(StreamTestData<Integer> data, Function<Stream<Integer>, Stream<Integer>> fs) {
-        Optional<Integer> r = withData(data).terminal(fs, s -> s.findAny()).equalator(VALID_ANSWER).exercise();
-        if (r.isPresent()) {
-            Integer ir = r.get();
+        Optional<Integer> or = withData(data).terminal(fs, s -> s.findAny()).equalator(VALID_ANSWER).exercise();
+        if (or.isPresent()) {
+            Integer r = or.get();
             Iterator<Integer> it = fs.apply(data.stream()).iterator();
             boolean contained = false;
             while (!contained && it.hasNext()) {
-                contained = Objects.equals(ir, it.next());
+                contained = Objects.equals(r, it.next());
             }
             assertTrue(contained);
         }
@@ -90,17 +81,66 @@
     public void testIntStream(String name, IntStreamTestData data) {
         exerciseIntStream(data, s -> s);
         exerciseIntStream(data, s -> s.filter(ipTrue));
+        exerciseIntStream(data, s -> s.filter(ipFalse));
         exerciseIntStream(data, s -> s.filter(ipEven));
     }
 
     void exerciseIntStream(IntStreamTestData data, Function<IntStream, IntStream> fs) {
-        OptionalInt r = withData(data).terminal(fs, s -> s.findAny()).equalator(INT_VALID_ANSWER).exercise();
-        if (r.isPresent()) {
-            int ir = r.getAsInt();
+        OptionalInt or = withData(data).terminal(fs, s -> s.findAny()).equalator(INT_VALID_ANSWER).exercise();
+        if (or.isPresent()) {
+            int r = or.getAsInt();
             PrimitiveIterator<Integer> it = fs.apply(data.stream()).iterator();
             boolean contained = false;
             while (!contained && it.hasNext()) {
-                contained = ir == it.nextInt();
+                contained = r == it.nextInt();
+            }
+            assertTrue(contained);
+        }
+        else {
+            assertFalse(fs.apply(data.stream()).iterator().hasNext());
+        }
+    }
+
+    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    public void testLongStream(String name, LongStreamTestData data) {
+        exerciseLongStream(data, s -> s);
+        exerciseLongStream(data, s -> s.filter(lpTrue));
+        exerciseLongStream(data, s -> s.filter(lpFalse));
+        exerciseLongStream(data, s -> s.filter(lpEven));
+    }
+
+    void exerciseLongStream(LongStreamTestData data, Function<LongStream, LongStream> fs) {
+        OptionalLong or = withData(data).terminal(fs, s -> s.findAny()).equalator(LONG_VALID_ANSWER).exercise();
+        if (or.isPresent()) {
+            long r = or.getAsLong();
+            PrimitiveIterator<Long> it = fs.apply(data.stream()).iterator();
+            boolean contained = false;
+            while (!contained && it.hasNext()) {
+                contained = r == it.nextLong();
+            }
+            assertTrue(contained);
+        }
+        else {
+            assertFalse(fs.apply(data.stream()).iterator().hasNext());
+        }
+    }
+
+    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    public void testDoubleStream(String name, DoubleStreamTestData data) {
+        exerciseDoubleStream(data, s -> s);
+        exerciseDoubleStream(data, s -> s.filter(dpTrue));
+        exerciseDoubleStream(data, s -> s.filter(dpEven));
+        exerciseDoubleStream(data, s -> s.filter(dpFalse));
+    }
+
+    void exerciseDoubleStream(DoubleStreamTestData data, Function<DoubleStream, DoubleStream> fs) {
+        OptionalDouble or = withData(data).terminal(fs, s -> s.findAny()).equalator(DOUBLE_VALID_ANSWER).exercise();
+        if (or.isPresent()) {
+            double r = or.getAsDouble();
+            PrimitiveIterator<Double> it = fs.apply(data.stream()).iterator();
+            boolean contained = false;
+            while (!contained && it.hasNext()) {
+                contained = r == it.nextDouble();
             }
             assertTrue(contained);
         }
@@ -113,4 +153,7 @@
 
     static final BiBlock<OptionalInt, OptionalInt> INT_VALID_ANSWER = (a, b) -> assertEquals(a.isPresent(), b.isPresent());
 
+    static final BiBlock<OptionalLong, OptionalLong> LONG_VALID_ANSWER = (a, b) -> assertEquals(a.isPresent(), b.isPresent());
+
+    static final BiBlock<OptionalDouble, OptionalDouble> DOUBLE_VALID_ANSWER = (a, b) -> assertEquals(a.isPresent(), b.isPresent());
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/FindFirstOpTest.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/FindFirstOpTest.java	Mon Jan 21 18:11:03 2013 +0100
@@ -24,22 +24,12 @@
  */
 package org.openjdk.tests.java.util.stream;
 
-import java.util.stream.OpTestCase;
-import java.util.stream.StreamTestData;
-import java.util.stream.StreamTestDataProvider;
-import java.util.stream.IntStreamTestData;
-import java.util.stream.IntStreamTestDataProvider;
+import java.util.*;
+import java.util.stream.*;
+
 import org.testng.annotations.Test;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.Optional;
 import java.util.function.Function;
-import java.util.stream.Stream;
-import java.util.OptionalInt;
-import java.util.stream.IntStream;
-import java.util.PrimitiveIterator;
 
 import static java.util.stream.LambdaTestHelpers.*;
 
@@ -65,9 +55,9 @@
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
     public void testStream(String name, StreamTestData<Integer> data) {
         exerciseStream(data, s -> s);
-        exerciseStream(data, s -> s.filter(pEven));
         exerciseStream(data, s -> s.filter(pTrue));
         exerciseStream(data, s -> s.filter(pFalse));
+        exerciseStream(data, s -> s.filter(pEven));
     }
 
     void exerciseStream(StreamTestData<Integer> data, Function<Stream<Integer>, Stream<Integer>> fs) {
@@ -85,9 +75,9 @@
     @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
     public void testIntStream(String name, IntStreamTestData data) {
         exerciseIntStream(data, s -> s);
-        exerciseIntStream(data, s -> s.filter(ipEven));
         exerciseIntStream(data, s -> s.filter(ipTrue));
         exerciseIntStream(data, s -> s.filter(ipFalse));
+        exerciseIntStream(data, s -> s.filter(ipEven));
     }
 
     void exerciseIntStream(IntStreamTestData data, Function<IntStream, IntStream> fs) {
@@ -101,4 +91,44 @@
             assertFalse(fs.apply(data.stream()).iterator().hasNext());
         }
     }
+
+    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    public void testLongStream(String name, LongStreamTestData data) {
+        exerciseLongStream(data, s -> s);
+        exerciseLongStream(data, s -> s.filter(lpTrue));
+        exerciseLongStream(data, s -> s.filter(lpFalse));
+        exerciseLongStream(data, s -> s.filter(lpEven));
+    }
+
+    void exerciseLongStream(LongStreamTestData data, Function<LongStream, LongStream> fs) {
+        OptionalLong r = exerciseTerminalOps(data, fs, s -> s.findFirst());
+        if (r.isPresent()) {
+            PrimitiveIterator<Long> i = fs.apply(data.stream()).iterator();
+            assertTrue(i.hasNext());
+            assertEquals(i.nextLong(), r.getAsLong());
+        }
+        else {
+            assertFalse(fs.apply(data.stream()).iterator().hasNext());
+        }
+    }
+
+    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    public void testDoubleStream(String name, DoubleStreamTestData data) {
+        exerciseDoubleStream(data, s -> s);
+        exerciseDoubleStream(data, s -> s.filter(dpTrue));
+        exerciseDoubleStream(data, s -> s.filter(dpFalse));
+        exerciseDoubleStream(data, s -> s.filter(dpEven));
+    }
+
+    void exerciseDoubleStream(DoubleStreamTestData data, Function<DoubleStream, DoubleStream> fs) {
+        OptionalDouble r = exerciseTerminalOps(data, fs, s -> s.findFirst());
+        if (r.isPresent()) {
+            PrimitiveIterator<Double> i = fs.apply(data.stream()).iterator();
+            assertTrue(i.hasNext());
+            assertEquals(i.nextDouble(), r.getAsDouble());
+        }
+        else {
+            assertFalse(fs.apply(data.stream()).iterator().hasNext());
+        }
+    }
 }
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/IntMinMaxTest.java	Mon Jan 21 16:17:22 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2012, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package org.openjdk.tests.java.util.stream;
-
-import java.util.stream.IntStreamTestData;
-import java.util.stream.IntStreamTestDataProvider;
-import java.util.stream.OpTestCase;
-import org.testng.annotations.Test;
-
-import java.util.OptionalInt;
-import java.util.stream.Streams;
-
-public class IntMinMaxTest extends OpTestCase {
-
-    public void testMinBy() {
-        assertEquals(Streams.emptyIntStream().min(), OptionalInt.empty());
-        assertEquals(Streams.emptyIntStream().max(), OptionalInt.empty());
-        assertEquals(1, Streams.intRange(1, 1001).min().getAsInt());
-        assertEquals(1000, Streams.intRange(1, 1001).max().getAsInt());
-    }
-
-    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
-    public void testOps(String name, IntStreamTestData data) {
-        exerciseTerminalOps(data, s -> s.min());
-        exerciseTerminalOps(data, s -> s.max());
-    }
-}
\ No newline at end of file
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/MinMaxByTest.java	Mon Jan 21 16:17:22 2013 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2012, 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.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * 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.
- */
-package org.openjdk.tests.java.util.stream;
-
-import java.util.stream.OpTestCase;
-import java.util.stream.StreamTestData;
-import java.util.stream.StreamTestDataProvider;
-import org.testng.annotations.Test;
-
-import static java.util.stream.LambdaTestHelpers.countTo;
-
-/**
- * MinMaxByOpTest
- *
- * @author Brian Goetz
- */
-@Test
-public class MinMaxByTest extends OpTestCase {
-    public void testMinBy() {
-        assertTrue(!countTo(0).stream().min(Integer::compare).isPresent());
-        assertTrue(!countTo(0).stream().max(Integer::compare).isPresent());
-        assertEquals(1, (int) countTo(1000).stream().min(Integer::compare).get());
-        assertEquals(1000, (int) countTo(1000).stream().max(Integer::compare).get());
-    }
-
-    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
-    public void testOps(String name, StreamTestData<Integer> data) {
-        exerciseTerminalOps(data, s -> s.min(Integer::compare));
-        exerciseTerminalOps(data, s -> s.max(Integer::compare));
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/MinMaxTest.java	Mon Jan 21 18:11:03 2013 +0100
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2012, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+package org.openjdk.tests.java.util.stream;
+
+import java.util.OptionalDouble;
+import java.util.OptionalInt;
+import java.util.OptionalLong;
+import java.util.stream.*;
+
+import org.testng.annotations.Test;
+
+import static java.util.stream.LambdaTestHelpers.countTo;
+
+/**
+ * MinMaxTest
+ *
+ * @author Brian Goetz
+ */
+@Test
+public class MinMaxTest extends OpTestCase {
+    public void testMinMax() {
+        assertTrue(!countTo(0).stream().min(Integer::compare).isPresent());
+        assertTrue(!countTo(0).stream().max(Integer::compare).isPresent());
+        assertEquals(1, (int) countTo(1000).stream().min(Integer::compare).get());
+        assertEquals(1000, (int) countTo(1000).stream().max(Integer::compare).get());
+    }
+
+    @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
+    public void testOps(String name, StreamTestData<Integer> data) {
+        exerciseTerminalOps(data, s -> s.min(Integer::compare));
+        exerciseTerminalOps(data, s -> s.max(Integer::compare));
+    }
+
+    public void testIntMinMax() {
+        assertEquals(Streams.emptyIntStream().min(), OptionalInt.empty());
+        assertEquals(Streams.emptyIntStream().max(), OptionalInt.empty());
+        assertEquals(1, Streams.intRange(1, 1001).min().getAsInt());
+        assertEquals(1000, Streams.intRange(1, 1001).max().getAsInt());
+    }
+
+    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+    public void testIntOps(String name, IntStreamTestData data) {
+        exerciseTerminalOps(data, s -> s.min());
+        exerciseTerminalOps(data, s -> s.max());
+    }
+
+    public void testLongMinMax() {
+        assertEquals(Streams.emptyLongStream().min(), OptionalLong.empty());
+        assertEquals(Streams.emptyLongStream().max(), OptionalLong.empty());
+        assertEquals(1, Streams.longRange(1, 1001).min().getAsLong());
+        assertEquals(1000, Streams.longRange(1, 1001).max().getAsLong());
+    }
+
+    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    public void testLongOps(String name, LongStreamTestData data) {
+        exerciseTerminalOps(data, s -> s.min());
+        exerciseTerminalOps(data, s -> s.max());
+    }
+
+    public void testDoubleMinMax() {
+        assertEquals(Streams.emptyDoubleStream().min(), OptionalDouble.empty());
+        assertEquals(Streams.emptyDoubleStream().max(), OptionalDouble.empty());
+        assertEquals(1.0, Streams.longRange(1, 1001).toDouble().min().getAsDouble());
+        assertEquals(1000.0, Streams.longRange(1, 1001).toDouble().max().getAsDouble());
+    }
+
+    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    public void testDoubleOps(String name, DoubleStreamTestData data) {
+        exerciseTerminalOps(data, s -> s.min());
+        exerciseTerminalOps(data, s -> s.max());
+    }
+}
--- a/test-ng/tests/org/openjdk/tests/java/util/stream/TeeOpTest.java	Mon Jan 21 16:17:22 2013 +0100
+++ b/test-ng/tests/org/openjdk/tests/java/util/stream/TeeOpTest.java	Mon Jan 21 18:11:03 2013 +0100
@@ -24,16 +24,17 @@
  */
 package org.openjdk.tests.java.util.stream;
 
-import java.util.stream.OpTestCase;
-import java.util.stream.StreamTestData;
-import java.util.stream.StreamTestDataProvider;
+import java.util.function.DoubleBlock;
+import java.util.function.IntBlock;
+import java.util.function.LongBlock;
+import java.util.stream.*;
+
 import org.testng.annotations.Test;
 
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.function.Block;
-import java.util.stream.Stream;
 
 import static java.util.stream.LambdaTestHelpers.*;
 
@@ -41,46 +42,93 @@
  * TeeOpTest
  */
 public class TeeOpTest extends OpTestCase {
-    private <T> Block<T> asBlock(List<T> l) {
-        return t -> l.add(t);
-    }
 
     public void testTee() {
         List<Integer> copy = new ArrayList<>();
 
-        assertCountSum(countTo(0).stream().tee(asBlock(copy)), 0, 0);
+        assertCountSum(countTo(0).stream().tee(copy::add), 0, 0);
         assertCountSum(copy.iterator(), 0, 0);
 
         copy.clear();
-        assertCountSum(countTo(10).stream().tee(asBlock(copy)), 10, 55);
+        assertCountSum(countTo(10).stream().tee(copy::add), 10, 55);
         assertCountSum(copy.iterator(), 10, 55);
 
         copy.clear();
-        assertCountSum(countTo(10).stream().map(mDoubler).tee(asBlock(copy)), 10, 110);
+        assertCountSum(countTo(10).stream().map(mDoubler).tee(copy::add), 10, 110);
         assertCountSum(copy.iterator(), 10, 110);
     }
 
+    static class AbstractRecordingBlock<T> {
+        List<T> list;
+
+        void before(TestData<T, ?> td) {
+            // Tee block can be called concurrently
+            list = Collections.<T>synchronizedList(new ArrayList<>());
+        }
+
+        void after(TestData<T, ?> td) {
+            // No guarantees in parallel tests that calls to tee block will
+            // be in the encounter order, if defined, of the data
+            // @@@ Consider passing more meta-data about evaluation
+            assertContentsUnordered(list, td.into(new ArrayList<T>()));
+        }
+    }
+
     @Test(dataProvider = "StreamTestData<Integer>", dataProviderClass = StreamTestDataProvider.class)
     public void testOps(String name, final StreamTestData<Integer> data) {
-        class RecordingBlock implements Block<Integer> {
-            List<Integer> list;
-
-            void before(TestData<Integer, Stream<Integer>> td) {
-                // Tee block can be called concurrently
-                list = Collections.<Integer>synchronizedList(new ArrayList<>());
-            }
-
+        class RecordingBlock extends AbstractRecordingBlock<Integer> implements Block<Integer> {
             public void accept(Integer t) {
                 list.add(t);
             }
+        }
+        final RecordingBlock b = new RecordingBlock();
 
-            void after(TestData<Integer, Stream<Integer>> td) {
-                // No guarantees in parallel tests that calls to tee block will
-                // be in the encounter order, if defined, of the data
-                assertContentsUnordered(list, data.into(new ArrayList<Integer>()));
+        withData(data).
+                stream(s -> s.tee(b)).
+                before(b::before).
+                after(b::after).
+                exercise();
+    }
+
+    @Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
+    public void testIntOps(String name, final IntStreamTestData data) {
+        class RecordingBlock extends AbstractRecordingBlock<Integer> implements IntBlock {
+            public void accept(int t) {
+                list.add(t);
             }
         }
+        final RecordingBlock b = new RecordingBlock();
 
+        withData(data).
+                stream(s -> s.tee(b)).
+                before(b::before).
+                after(b::after).
+                exercise();
+    }
+
+    @Test(dataProvider = "LongStreamTestData", dataProviderClass = LongStreamTestDataProvider.class)
+    public void testLongOps(String name, final LongStreamTestData data) {
+        class RecordingBlock extends AbstractRecordingBlock<Long> implements LongBlock {
+            public void accept(long t) {
+                list.add(t);
+            }
+        }
+        final RecordingBlock b = new RecordingBlock();
+
+        withData(data).
+                stream(s -> s.tee(b)).
+                before(b::before).
+                after(b::after).
+                exercise();
+    }
+
+    @Test(dataProvider = "DoubleStreamTestData", dataProviderClass = DoubleStreamTestDataProvider.class)
+    public void testDoubleOps(String name, final DoubleStreamTestData data) {
+        class RecordingBlock extends AbstractRecordingBlock<Double> implements DoubleBlock {
+            public void accept(double t) {
+                list.add(t);
+            }
+        }
         final RecordingBlock b = new RecordingBlock();
 
         withData(data).