Day 11 part 1
This commit is contained in:
44
AdventOfCode2023.FSharp/Test/TestDay11.fs
Normal file
44
AdventOfCode2023.FSharp/Test/TestDay11.fs
Normal file
@@ -0,0 +1,44 @@
|
||||
namespace AdventOfCode2023.Test
|
||||
|
||||
open AdventOfCode2023
|
||||
open NUnit.Framework
|
||||
open FsUnitTyped
|
||||
open System.IO
|
||||
|
||||
[<TestFixture>]
|
||||
module TestDay11 =
|
||||
|
||||
let sample = Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day11.txt"
|
||||
|
||||
[<Test>]
|
||||
let part1Sample () =
|
||||
sample |> Day11.part1 |> shouldEqual 374
|
||||
|
||||
[<Test>]
|
||||
let part2Sample () = sample |> Day11.part2 |> shouldEqual -1
|
||||
|
||||
[<Test>]
|
||||
let part1Actual () =
|
||||
let s =
|
||||
try
|
||||
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day11.txt"))
|
||||
with
|
||||
| :? DirectoryNotFoundException
|
||||
| :? FileNotFoundException ->
|
||||
Assert.Inconclusive ()
|
||||
failwith "unreachable"
|
||||
|
||||
Day11.part1 s |> shouldEqual 9947476
|
||||
|
||||
[<Test>]
|
||||
let part2Actual () =
|
||||
let s =
|
||||
try
|
||||
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day11.txt"))
|
||||
with
|
||||
| :? DirectoryNotFoundException
|
||||
| :? FileNotFoundException ->
|
||||
Assert.Inconclusive ()
|
||||
failwith "unreachable"
|
||||
|
||||
Day11.part2 s |> shouldEqual -1
|
Reference in New Issue
Block a user