Day 11 part 1
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
<Compile Include="TestDay8.fs"/>
|
||||
<Compile Include="TestDay9.fs"/>
|
||||
<Compile Include="TestDay10.fs" />
|
||||
<Compile Include="TestDay11.fs" />
|
||||
<EmbeddedResource Include="samples\day1.txt"/>
|
||||
<EmbeddedResource Include="samples\day1part1.txt"/>
|
||||
<EmbeddedResource Include="samples\day2.txt"/>
|
||||
@@ -32,6 +33,7 @@
|
||||
<EmbeddedResource Include="samples\day9.txt"/>
|
||||
<EmbeddedResource Include="samples\day10part1.txt" />
|
||||
<EmbeddedResource Include="samples\day10.txt" />
|
||||
<EmbeddedResource Include="samples\day11.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
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
|
||||
@@ -15,10 +15,7 @@ module TestDay9 =
|
||||
sample |> Day9.part1 |> shouldEqual 114L
|
||||
|
||||
[<Test>]
|
||||
let part2Sample () =
|
||||
Assembly.getEmbeddedResource typeof<Dummy>.Assembly "day9.txt"
|
||||
|> Day9.part2
|
||||
|> shouldEqual 2L
|
||||
let part2Sample () = sample |> Day9.part2 |> shouldEqual 2L
|
||||
|
||||
[<Test>]
|
||||
let part1Actual () =
|
||||
|
||||
10
AdventOfCode2023.FSharp/Test/samples/day11.txt
Normal file
10
AdventOfCode2023.FSharp/Test/samples/day11.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
...#......
|
||||
.......#..
|
||||
#.........
|
||||
..........
|
||||
......#...
|
||||
.#........
|
||||
.........#
|
||||
..........
|
||||
.......#..
|
||||
#...#.....
|
||||
Reference in New Issue
Block a user