Skip to content

Commit

Permalink
add: test env play
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymax25 committed Jan 9, 2022
1 parent b594b54 commit f1e328e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions projet/funprog-al/src/test/scala/progFun/EnvironnementSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,19 @@ class EnvironnementSpec extends AnyFunSuite {
assert(executed.mowers(1).direction.equals(East()))

}

test("Env play execution should only update the first mower's direction only") {
val env = SpecHelper.getTestEnv()

val mowers = env.play

// mower 1
assert(mowers(0).startPoint.equals(mowers(0).point))
assert(mowers(0).direction.equals(West())) // same

// mower 2
assert(mowers(1).startPoint.equals(mowers(1).point)) // same
assert(mowers(1).startDirection.equals(mowers(1).direction)) // same

}
}
2 changes: 1 addition & 1 deletion projet/funprog-al/src/test/scala/progFun/MowerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MowerSpec extends AnyFunSuite {
assert(mower.id === 1)
}

test("Mower should advance a mower up once") {
test("Mower should advance up once") {
val mower = SpecHelper.getTestMower()

val updated = mower.advance(new Point(5, 5), Nil)
Expand Down

0 comments on commit f1e328e

Please sign in to comment.