-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay01Tests.cs
67 lines (48 loc) · 1.52 KB
/
Day01Tests.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
namespace advent_of_code_csharp_2024;
public class Day01Tests
{
private readonly string _testLines = @"3 4
4 3
2 5
1 3
3 9
3 3";
[Fact]
public void ExampleLines_Part1()
{
var lines = _testLines.Split(System.Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
var parsedLines = lines
.Select(Day01.ParseLine);
Assert.Equal(new Day01.Line(3, 4), parsedLines.First());
var ans = Day01.SolveDay1_Part1(parsedLines);
Assert.Equal(11, ans);
}
[Fact]
public void RealData_Part1()
{
var lines = File.ReadLines(Day01.InputFilename);
var parsedLines = lines
.Select(Day01.ParseLine);
var ans = Day01.SolveDay1_Part1(parsedLines);
Assert.Equal(1938424, ans);
}
[Fact]
public void ExampleData_Part2()
{
var lines = _testLines.Split(System.Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
var parsedLines = lines
.Select(Day01.ParseLine);
Assert.Equal(new Day01.Line(3, 4), parsedLines.First());
int answer = Day01.SolveDay1_Part2(parsedLines);
Assert.Equal(31, answer);
}
[Fact]
public void RealData_Part2()
{
var lines = File.ReadLines(Day01.InputFilename);
var parsedLines = lines
.Select(Day01.ParseLine);
var ans = Day01.SolveDay1_Part2(parsedLines);
Assert.Equal(22014209, ans);
}
}