namespace AdventOfCode2023.Test open System open AdventOfCode2023 open NUnit.Framework open FsUnitTyped open System.IO [] module TestDay13 = [] let ``rowToInt test`` () = Day13.rowToInt ("#.##..##.".AsSpan ()) |> shouldEqual 358ul [] let ``colToInt test`` () = let s = """#.##..##. ..#.##.#. ##......# ##......# ..#.##.#. ..##..##. #.#.##.#. """ Day13.colToInt (s.AsSpan ()) 9 0 |> shouldEqual (List.sum [ 1 ; 8 ; 16 ; 64 ] |> uint32) [] let sample = Assembly.getEmbeddedResource typeof.Assembly "day13.txt" [] let part1Sample () = sample |> Day13.part1 |> shouldEqual 405ul [] let part2Sample () = sample |> Day13.part2 |> shouldEqual 400ul [] let part1Actual () = let s = try File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day13.txt")) with | :? DirectoryNotFoundException | :? FileNotFoundException -> Assert.Inconclusive () failwith "unreachable" Day13.part1 s |> shouldEqual 30158ul [] let part2Actual () = let s = try File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day13.txt")) with | :? DirectoryNotFoundException | :? FileNotFoundException -> Assert.Inconclusive () failwith "unreachable" Day13.part2 s |> shouldEqual 36474ul