Files
advent-of-code-2023/AdventOfCode2023.FSharp/Test/TestDay19.fs
patrick 7646fb71c3
All checks were successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/all-checks-complete Pipeline was successful
Day 19 (#19)
Can't be bothered to get it faster

Co-authored-by: Smaug123 <patrick+github@patrickstevens.co.uk>
Reviewed-on: #19
2023-12-23 19:58:35 +00:00

56 lines
1.6 KiB
Forth

namespace AdventOfCode2023.Test
open AdventOfCode2023
open NUnit.Framework
open FsUnitTyped
open System.IO
[<TestFixture>]
module TestDay19 =
[<Test>]
let sample = Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day19.txt"
[<Test>]
let part1Sample () =
use mutable s = StringSplitEnumerator.make '\n' sample
let workflows = Day19.readWorkflows &s
Day19.part1 workflows &s |> shouldEqual 19114
[<Test>]
let part2Sample () =
use mutable s = StringSplitEnumerator.make '\n' sample
let workflows = Day19.readWorkflows &s
Day19.part2 workflows &s |> shouldEqual 167409079868000uL
[<Test>]
let part1Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day19.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
use mutable s = StringSplitEnumerator.make '\n' s
let workflows = Day19.readWorkflows &s
Day19.part1 workflows &s |> shouldEqual 368964
[<Test>]
let part2Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day19.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
use mutable s = StringSplitEnumerator.make '\n' s
let workflows = Day19.readWorkflows &s
Day19.part2 workflows &s |> shouldEqual 127675188176682uL