From 2df58fc93a49a3ea3881d2cf74b6aeed1c2e37d9 Mon Sep 17 00:00:00 2001 From: Jérémy Zurcher Date: Sat, 18 May 2013 14:20:03 +0200 Subject: Scala : streams assignment Scala : completed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/scala/streams/BloxorzSuite.scala | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'Scala/streams/src/test') diff --git a/Scala/streams/src/test/scala/streams/BloxorzSuite.scala b/Scala/streams/src/test/scala/streams/BloxorzSuite.scala index 3f9329b..72ef1a4 100644 --- a/Scala/streams/src/test/scala/streams/BloxorzSuite.scala +++ b/Scala/streams/src/test/scala/streams/BloxorzSuite.scala @@ -53,6 +53,29 @@ class BloxorzSuite extends FunSuite { } } + test("neighborsWithHistory") { + new Level1 { + assert(neighborsWithHistory(Block(Pos(1,1),Pos(1,1)), List(Left,Up)) === + Stream( + (Block(Pos(1,2),Pos(1,3)), List(Right,Left,Up)), + (Block(Pos(2,1),Pos(3,1)), List(Down,Left,Up)) + )) + } + } + + test("newNeighborsOnly") { + new Level1 { + assert(newNeighborsOnly( + Set( + (Block(Pos(1,2),Pos(1,3)), List(Right,Left,Up)), + (Block(Pos(2,1),Pos(3,1)), List(Down,Left,Up))).toStream, + Set(Block(Pos(1,2),Pos(1,3)), Block(Pos(1,1),Pos(1,1))) + ) == + Set((Block(Pos(2,1),Pos(3,1)), List(Down,Left,Up))).toStream + ) + } + } + test("optimal solution for level 1") { new Level1 { assert(solve(solution) == Block(goal, goal)) -- cgit v1.2.3