feat(fsharp): m01-m06 util, model, rules, random, spawn, game, view with Expecto tests

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Lucas Winther
2026-10-29 00:49:42 +01:00
co-authored by Claude Opus 5.5
parent 183821737e
commit 9cbefeb2be
27 changed files with 851 additions and 6 deletions
+21
View File
@@ -0,0 +1,21 @@
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")
]