module Snake.Tests.M00Sanity open System.Text.Json open Expecto open Snake.Tests [] let tests = testList "M00 sanity" [ test "arithmetic" { Expect.equal (1 + 1) 2 "1 + 1" } test "fixture loads and cases hold" { Expect.equal ((Fixtures.load "m00-sanity").GetProperty("function").GetString()) "sanity" "function" for c in Fixtures.cases "m00-sanity" do let a = c.GetProperty("args").EnumerateArray() |> Seq.map (fun e -> e.GetInt32()) |> List.ofSeq Expect.equal (List.sum a) (c.GetProperty("expected").GetInt32()) (c.GetProperty("name").GetString()) } test "opt decodes null" { use d = JsonDocument.Parse("null") Expect.isNone (Fixtures.opt (fun e -> e.GetInt32()) d.RootElement) "null" } ]