Commit 256beeaf authored by pysaumont's avatar pysaumont
Browse files

Fixed compilation errors

parent fb0d18f5
......@@ -12,13 +12,13 @@ public class HeapTest {
public void testAdd() throws Exception {
List<Integer> list = List.list(1, 2, 3, 4, 5, 6, 7);
Heap<Integer> queue = list.foldLeft(Heap.<Integer>empty(), h -> h::add);
list.zipWithPosition().forEachOrThrow(testList -> List.sequence(testList.map(t -> queue.get(t._2).map(v -> v.equals(t._1)))).map(lst -> lst.forAll(x -> x)).forEachOrThrow(Assert::assertTrue));
list.zipWithPositionResult().forEachOrThrow(testList -> List.sequence(testList.map(t -> queue.get(t._2).map(v -> v.equals(t._1)))).map(lst -> lst.forAll(x -> x)).forEachOrThrow(Assert::assertTrue));
}
@Test
public void testAdd2() throws Exception {
List<Integer> list = List.list(7, 3, 1, 6, 4, 6, 2);
Heap<Integer> queue = list.foldLeft(Heap.<Integer>empty(), h -> h::add);
List.list(1, 2, 3, 4, 6, 6, 7).zipWithPosition().forEachOrThrow(testList -> List.sequence(testList.map(t -> queue.get(t._2).map(v -> v.equals(t._1)))).map(lst -> lst.forAll(x -> x)).forEachOrThrow(Assert::assertTrue));
List.list(1, 2, 3, 4, 6, 6, 7).zipWithPositionResult().forEachOrThrow(testList -> List.sequence(testList.map(t -> queue.get(t._2).map(v -> v.equals(t._1)))).map(lst -> lst.forAll(x -> x)).forEachOrThrow(Assert::assertTrue));
}
}
......@@ -37,7 +37,7 @@ public class HeapPrint {
.insert(1);
System.out.println(toString(heap3));
List.list(1, 2, 2, 2, 6, 7, 5, 0, 5, 1).zipWithPosition().forEachOrThrow(points -> {
List.list(1, 2, 2, 2, 6, 7, 5, 0, 5, 1).zipWithPositionResult().forEachOrThrow(points -> {
Heap<Point> heap = points.foldLeft(Heap.empty(), h -> t -> h.insert(new Point(t._1, t._2)));
List<Point> lp = List.unfold(heap, hp -> hp.head().flatMap(h -> hp.tail().map(t -> new Tuple<>(h, t))));
System.out.println(points);
......
......@@ -185,7 +185,7 @@ public class HeapTest {
@Test
public void testInsertRandomPoint() {
int limit = 20_000;
SimpleRNG.doubles(limit, new SimpleRNG.Simple(3))._1.map(x -> (int) (x * limit * 3)).zipWithPosition().forEachOrThrow(points -> {
SimpleRNG.doubles(limit, new SimpleRNG.Simple(3))._1.map(x -> (int) (x * limit * 3)).zipWithPositionResult().forEachOrThrow(points -> {
Heap<Point> heap = points.foldLeft(Heap.empty(), h -> t -> h.insert(new Point(t._1, t._2)));
assertEquals(limit, heap.length());
assertTrue(isBalanced(heap));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment