summaryrefslogtreecommitdiffstats
path: root/Scala/streams/src/test
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-05-18 14:20:03 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2016-11-10 18:03:25 +0100
commit2df58fc93a49a3ea3881d2cf74b6aeed1c2e37d9 (patch)
tree0ad5112cf82e131687ce2974c9277758982009e5 /Scala/streams/src/test
parent68feb40b64c1e3bd5c329168473d0fca2e9d5190 (diff)
downloadcoursera-scala.zip
coursera-scala.tar.gz
Scala : streams assignment Scala : completedscala
Diffstat (limited to 'Scala/streams/src/test')
-rw-r--r--Scala/streams/src/test/scala/streams/BloxorzSuite.scala23
1 files changed, 23 insertions, 0 deletions
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))