This commit is contained in:
Smaug123
2023-12-08 21:19:07 +00:00
parent d94663ae0e
commit 471273633c
4 changed files with 88 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
<Compile Include="TestDay6.fs" />
<Compile Include="TestDay7.fs" />
<Compile Include="TestDay8.fs" />
<Compile Include="TestDay9.fs" />
<EmbeddedResource Include="samples\day1.txt" />
<EmbeddedResource Include="samples\day1part1.txt" />
<EmbeddedResource Include="samples\day2.txt" />

View File

@@ -0,0 +1,49 @@
namespace AdventOfCode2023.Test
open AdventOfCode2023
open NUnit.Framework
open FsUnitTyped
open System.IO
[<TestFixture>]
module TestDay9 =
let sample = Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day9.txt"
[<Test>]
let part1Sample () =
sample
|> Day9.part1
|> shouldEqual 2
[<Test>]
let part2Sample () =
Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day9.txt"
|> Day9.part2
|> shouldEqual 0
[<Test>]
let part1Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day9.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
Day8.part1 s |> shouldEqual 0
[<Test>]
let part2Actual () =
let s =
try
File.ReadAllText (Path.Combine (__SOURCE_DIRECTORY__, "../../inputs/day9.txt"))
with
| :? DirectoryNotFoundException
| :? FileNotFoundException ->
Assert.Inconclusive ()
failwith "unreachable"
Day8.part2 s |> shouldEqual 0