Files
advent-of-code-2023/AdventOfCode2023.FSharp/Test/TestDay6.fs
patrick 3b98d704d1
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
Day 9 (#10)
Went with Lagrange interpolation instead because that seemed easier.

Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk>
Reviewed-on: #10
2023-12-09 09:46:17 +00:00

46 lines
1.2 KiB
Forth

namespace AdventOfCode2023.Test
open AdventOfCode2023
open NUnit.Framework
open FsUnitTyped
open System.IO
[<TestFixture>]
module TestDay6 =
let sample = Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day6.txt"
[<Test>]
let part1Sample () =
sample |> Day6.part1 |> shouldEqual 288uL
[<Test>]
let part2Sample () =
sample |> Day6.part2 |> shouldEqual 71503uL
[<Test>]
let part1Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day6.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
Day6.part1 s |> shouldEqual 32076uL
[<Test>]
let part2Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day6.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
Day6.part2 s |> shouldEqual 34278221uL