chore: scaffold tracks and tooling
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6dc5bdde9e
commit
e150b7fefb
@@ -0,0 +1,21 @@
|
||||
/// Loads shared fixtures from ../../fixtures/<name>.json.
|
||||
/// Typed decoders (point, direction, status, action, state, opt) arrive with the model (Task 13).
|
||||
module Snake.Tests.Fixtures
|
||||
|
||||
open System.IO
|
||||
open System.Text.Json
|
||||
|
||||
let private dir =
|
||||
Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), "..", "fixtures"))
|
||||
|
||||
let load (name: string) : JsonElement =
|
||||
use doc = JsonDocument.Parse(File.ReadAllText(Path.Combine(dir, name + ".json")))
|
||||
doc.RootElement.Clone()
|
||||
|
||||
/// The cases array of a fixture.
|
||||
let cases (name: string) : JsonElement list =
|
||||
(load name).GetProperty("cases").EnumerateArray() |> List.ofSeq
|
||||
|
||||
/// Decode a nullable JSON value into an Option.
|
||||
let opt (f: JsonElement -> 'a) (v: JsonElement) : 'a option =
|
||||
if v.ValueKind = JsonValueKind.Null then None else Some(f v)
|
||||
Reference in New Issue
Block a user