From ea01520a7aa3b1679ff139aeb60bf5d86bc1a4b0 Mon Sep 17 00:00:00 2001 From: Jens Peters Date: Fri, 15 Nov 2024 15:56:41 +0100 Subject: [PATCH] 2024: Introduce FsUnit --- 2024/aoc2024.fsproj | 1 + 2024/src/Day00.fs | 8 ++++---- 2024/src/Util.fs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/2024/aoc2024.fsproj b/2024/aoc2024.fsproj index 7fcda34..716c5c2 100644 --- a/2024/aoc2024.fsproj +++ b/2024/aoc2024.fsproj @@ -12,6 +12,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/2024/src/Day00.fs b/2024/src/Day00.fs index 5d15de9..8b7f2e2 100644 --- a/2024/src/Day00.fs +++ b/2024/src/Day00.fs @@ -1,11 +1,11 @@ namespace aoc2024 open Xunit +open FsUnit.Xunit +open Util module Day00 = [] - let ``Part 01`` () = - let lines = Util.ReadInput("day00-input.txt") - let first = lines |> Seq.head |> int - Assert.Equal(0, first) + let ``part 01``() = + input "day00-input.txt" |> Seq.head |> int |> should equal 0 diff --git a/2024/src/Util.fs b/2024/src/Util.fs index 03fc4a9..71fb268 100644 --- a/2024/src/Util.fs +++ b/2024/src/Util.fs @@ -4,6 +4,6 @@ open System module Util = - let ReadInput(name: string) = + let input(name: string) = let path = $"{Reflection.Assembly.GetExecutingAssembly().Location}/../../../../data/{name}" seq { yield! IO.File.ReadLines path } \ No newline at end of file