-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay9Test.php
90 lines (77 loc) · 1.06 KB
/
Day9Test.php
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
declare(strict_types=1);
namespace XonneX\AdventOfCode\Y2020\Solutions\Day9;
use PHPUnit\Framework\TestCase;
class Day9Test extends TestCase
{
public function testSolvePartOneExample(): void
{
$day9 = new Day9();
$lines = explode(
"\n",
<<<TXT
35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576
TXT
);
self::assertSame('127', $day9->findNotMatchingNumber(5, $lines));
}
public function testSolvePartOne(): void
{
$day9 = new Day9();
self::assertSame('29221323', $day9->solvePartOne());
}
public function testSolvePartTwoExample(): void
{
$day9 = new Day9();
$lines = explode(
"\n",
<<<TXT
35
20
15
25
47
40
62
55
65
95
102
117
150
182
127
219
299
277
309
576
TXT
);
self::assertSame('62', $day9->findSumOfNotMatchingNumber(5, $lines));
}
public function testSolvePartTwo(): void
{
$day9 = new Day9();
self::assertSame('4389369', $day9->solvePartTwo());
}
}