Java 类java.util.stream.IntStreamTestDataProvider 实例源码

项目:openjdk-jdk10    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    long expectedCount = data.size();

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount).
            exercise();

    withData(data).
            terminal(s -> s.filter(e -> true), IntStream::count).
            expectedResult(expectedCount).
            exercise();

    expectedCount = data.into(new HashSet<>()).size();
    withData(data).
            terminal(IntStream::distinct, IntStream::count).
            expectedResult(expectedCount).
            exercise();
    withData(data).
            terminal(s -> s.unordered().distinct(), IntStream::count).
            expectedResult(expectedCount).
            exercise();
}
项目:openjdk9    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    long expectedCount = data.size();

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount).
            exercise();

    withData(data).
            terminal(s -> s.filter(e -> true), IntStream::count).
            expectedResult(expectedCount).
            exercise();

    expectedCount = data.into(new HashSet<>()).size();
    withData(data).
            terminal(IntStream::distinct, IntStream::count).
            expectedResult(expectedCount).
            exercise();
    withData(data).
            terminal(s -> s.unordered().distinct(), IntStream::count).
            expectedResult(expectedCount).
            exercise();
}
项目:jdk8u-jdk    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:jdk8u-jdk    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:jdk8u-jdk    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:openjdk-jdk10    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:openjdk-jdk10    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:openjdk-jdk10    文件:FlatMapOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntOps(String name, TestData.OfInt data) {
    Collection<Integer> 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());
}
项目:openjdk9    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:openjdk9    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:openjdk9    文件:FlatMapOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntOps(String name, TestData.OfInt data) {
    Collection<Integer> 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());
}
项目:jdk8u_jdk    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:jdk8u_jdk    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:jdk8u_jdk    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:lookaside_java-1.8.0-openjdk    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:lookaside_java-1.8.0-openjdk    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:infobip-open-jdk-8    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:infobip-open-jdk-8    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:infobip-open-jdk-8    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:jdk8u-dev-jdk    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:jdk8u-dev-jdk    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:jdk8u-dev-jdk    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:OLD-OpenJDK8    文件:MatchOpTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntStream(String name, TestData.OfInt data) {
    for (IntPredicate p : INT_PREDICATES) {
        setContext("p", p);
        for (Kind kind : Kind.values()) {
            setContext("kind", kind);
            exerciseTerminalOps(data, intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipFalse), intKinds.get(kind).apply(p));
            exerciseTerminalOps(data, s -> s.filter(ipEven), intKinds.get(kind).apply(p));
        }
    }
}
项目:OLD-OpenJDK8    文件:CountTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    AtomicLong expectedCount = new AtomicLong();
    data.stream().forEach(e -> expectedCount.incrementAndGet());

    withData(data).
            terminal(IntStream::count).
            expectedResult(expectedCount.get()).
            exercise();
}
项目:OLD-OpenJDK8    文件:IntReduceTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testOps(String name, TestData.OfInt data) {
    assertEquals(0, (int) exerciseTerminalOps(data, s -> s.filter(ipFalse), s -> s.reduce(0, irPlus)));

    OptionalInt seedless = exerciseTerminalOps(data, s -> s.reduce(irPlus));
    int folded = exerciseTerminalOps(data, s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irPlus));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(0, irPlus));
    assertEquals(folded, seedless.orElse(0));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMin));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MAX_VALUE, irMin));
    assertEquals(folded, seedless.orElse(Integer.MAX_VALUE));

    seedless = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(irMax));
    folded = exerciseTerminalOps(data, s -> s.map(irDoubler), s -> s.reduce(Integer.MIN_VALUE, irMax));
    assertEquals(folded, seedless.orElse(Integer.MIN_VALUE));
}
项目:jdk8u-jdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:jdk8u-jdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
项目:openjdk-jdk10    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:openjdk-jdk10    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
项目:openjdk-jdk10    文件:FlatMapOpTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntOpsX(String name, TestData.OfInt data) {
    exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e)));
    exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10)));
}
项目:openjdk9    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:openjdk9    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
项目:openjdk9    文件:FlatMapOpTest.java   
@Test(dataProvider = "IntStreamTestData.small", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntOpsX(String name, TestData.OfInt data) {
    exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e)));
    exerciseOps(data, s -> s.flatMap(e -> IntStream.range(0, e).limit(10)));
}
项目:jdk8u_jdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:jdk8u_jdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}
项目:infobip-open-jdk-8    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.stream()).spliterator());
    }
}
项目:infobip-open-jdk-8    文件:StreamSpliteratorTest.java   
@Test(dataProvider = "IntStreamTestData", dataProviderClass = IntStreamTestDataProvider.class)
public void testIntParSpliterators(String name, TestData.OfInt data) {
    for (Function<IntStream, IntStream> f : intStreamFunctions()) {
        SpliteratorTestHelper.testIntSpliterator(() -> f.apply(data.parallelStream()).spliterator());
    }
}