Skip to content

Commit

Permalink
Remove SQ warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
minborg committed Nov 18, 2021
1 parent b63f733 commit a110b1e
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public static <T, U, R> Stream<R> of(Collection<T> ts,
}


public static <T, U, V, R> Stream<Product3<T, U, V>> of(Collection<T> ts,
Collection<U> us,
Collection<V> vs) {
public static <T, U, V> Stream<Product3<T, U, V>> of(Collection<T> ts,
Collection<U> us,
Collection<V> vs) {
requireNonNull(ts);
requireNonNull(us);
requireNonNull(vs);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package net.openhft.chronicle.testframework.internal;

import net.openhft.chronicle.testframework.Combination;
import net.openhft.chronicle.testframework.Permutation;
import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertEquals;

class CombPermDemoTest {

@Test
void demo() {
assertEquals(16,
Combination.of("A", "B", "C")
.flatMap(Permutation::of)
.distinct()
.peek(System.out::println)
.count());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,24 @@
import java.util.function.Consumer;
import java.util.stream.Stream;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author Per Minborg
*/
final class CombinationDemo {
final class CombinationDemoTest {

@Test
void print() {
Combination.of("A", "B", "C")
.forEach(System.out::println);
assertEquals(8,
Combination.of("A", "B", "C")
.peek(System.out::println)
.count());
}

@TestFactory
// Try all combinations of cosmic ray interference
@TestFactory
Stream<DynamicTest> demo() {
return DynamicTest.stream(Combination.<Consumer<FaultTolerantBitSet>>of(
FaultTolerantBitSet::cosmicRayBit3,
Expand All @@ -64,13 +67,10 @@ public void cosmicRayBit23() {
public void cosmicRayBit13() {
}


boolean isValid() {
return true;
}

}


}

}
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@

import static org.junit.jupiter.api.Assertions.assertEquals;

final class PermutationDemo {
final class PermutationDemoTest {

@Test
void print() {
Permutation.of("A", "B", "C")
.forEach(System.out::println);
assertEquals(6,
Permutation.of("A", "B", "C")
.peek(System.out::println)
.count());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

final class ProductDemo {
final class ProductDemoTest {

@Test
void print() {
Product.of(Arrays.asList("A", "B", "C"), Arrays.asList(1, 2, 3))
.forEach(System.out::println);
assertEquals(9,
Product.of(Arrays.asList("A", "B", "C"), Arrays.asList(1, 2, 3))
.peek(System.out::println)
.count());
}

// Exhaustively tests if various empty collections invariants holds
Expand All @@ -54,7 +56,7 @@ Stream<DynamicTest> demo() {
return DynamicTest.stream(Product.of(collections, operations),
Objects::toString,
tuple -> tuple.second().accept(tuple.first())
);
);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import java.util.function.Supplier;
import java.util.stream.LongStream;

public class SeriesDemo {
import static org.junit.jupiter.api.Assertions.assertEquals;

class SeriesDemoTest {

@Test
void demo() {
Expand All @@ -22,6 +24,8 @@ void demo() {

System.out.println("Primes (20):");
print(() -> Series.primes().limit(20));

assertEquals(64, Series.powersOfTwo().count());
}

private static void print(Supplier<LongStream> supplier) {
Expand Down

0 comments on commit a110b1e

Please sign in to comment.