Files
functional-programming-snake/fsharp/tests/M03Rules.fs
T

22 lines
812 B
FSharp

module Snake.Tests.M03Rules
open Expecto
open Snake
open Snake.Tests.Fixtures
[<Tests>]
let tests =
testList "M03 Rules" [
yield! fixtureTests "m03-move" "move" (fun c ->
Expect.equal (Rules.move (point (arg 0 c)) (direction (arg 1 c))) (point (expected c)) "move")
yield! fixtureTests "m03-in-bounds" "inBounds" (fun c ->
Expect.equal (Rules.inBounds (gameState (arg 0 c)) (point (arg 1 c))) (bool (expected c)) "inBounds")
yield! fixtureTests "m03-turn" "turn" (fun c ->
Expect.equal (Rules.turn (gameState (arg 0 c)) (direction (arg 1 c))) (gameState (expected c)) "turn")
yield! fixtureTests "m03-advance" "advance" (fun c ->
Expect.equal (Rules.advance (gameState (arg 0 c))) (gameState (expected c)) "advance")
]