Code cleanup
This commit is contained in:
@@ -1,49 +1,46 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day01_Tests
|
||||
{
|
||||
public class Day01_Tests
|
||||
#region ResolvePart1
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
#region ResolvePart1
|
||||
var day = new Day01();
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day01();
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"1721",
|
||||
"979",
|
||||
"366",
|
||||
"299",
|
||||
"675",
|
||||
"1456",
|
||||
});
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"1721",
|
||||
"979",
|
||||
"366",
|
||||
"299",
|
||||
"675",
|
||||
"1456",
|
||||
});
|
||||
|
||||
Assert.Equal("514579", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
|
||||
#region ResolvePart2
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day01();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"1721",
|
||||
"979",
|
||||
"366",
|
||||
"299",
|
||||
"675",
|
||||
"1456",
|
||||
});
|
||||
|
||||
Assert.Equal("241861950", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart2
|
||||
Assert.Equal("514579", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
|
||||
#region ResolvePart2
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day01();
|
||||
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"1721",
|
||||
"979",
|
||||
"366",
|
||||
"299",
|
||||
"675",
|
||||
"1456",
|
||||
});
|
||||
|
||||
Assert.Equal("241861950", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart2
|
||||
}
|
||||
@@ -1,43 +1,40 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day02_Tests
|
||||
{
|
||||
public class Day02_Tests
|
||||
#region ResolvePart1
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
#region ResolvePart1
|
||||
var day = new Day02();
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day02();
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
});
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
});
|
||||
|
||||
Assert.Equal("2", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
|
||||
#region ResolvePart2
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day02();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
});
|
||||
|
||||
Assert.Equal("1", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
Assert.Equal("2", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
|
||||
#region ResolvePart2
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day02();
|
||||
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"1-3 a: abcde",
|
||||
"1-3 b: cdefg",
|
||||
"2-9 c: ccccccccc",
|
||||
});
|
||||
|
||||
Assert.Equal("1", result);
|
||||
}
|
||||
|
||||
#endregion ResolvePart1
|
||||
}
|
||||
@@ -1,51 +1,48 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day03_Tests
|
||||
{
|
||||
public class Day03_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day03();
|
||||
var day = new Day03();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"..##.......",
|
||||
"#...#...#..",
|
||||
".#....#..#.",
|
||||
"..#.#...#.#",
|
||||
".#...##..#.",
|
||||
"..#.##.....",
|
||||
".#.#.#....#",
|
||||
".#........#",
|
||||
"#.##...#...",
|
||||
"#...##....#",
|
||||
".#..#...#.#",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"..##.......",
|
||||
"#...#...#..",
|
||||
".#....#..#.",
|
||||
"..#.#...#.#",
|
||||
".#...##..#.",
|
||||
"..#.##.....",
|
||||
".#.#.#....#",
|
||||
".#........#",
|
||||
"#.##...#...",
|
||||
"#...##....#",
|
||||
".#..#...#.#",
|
||||
});
|
||||
|
||||
Assert.Equal("7", result);
|
||||
}
|
||||
Assert.Equal("7", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day03();
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day03();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"..##.......",
|
||||
"#...#...#..",
|
||||
".#....#..#.",
|
||||
"..#.#...#.#",
|
||||
".#...##..#.",
|
||||
"..#.##.....",
|
||||
".#.#.#....#",
|
||||
".#........#",
|
||||
"#.##...#...",
|
||||
"#...##....#",
|
||||
".#..#...#.#",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"..##.......",
|
||||
"#...#...#..",
|
||||
".#....#..#.",
|
||||
"..#.#...#.#",
|
||||
".#...##..#.",
|
||||
"..#.##.....",
|
||||
".#.#.#....#",
|
||||
".#........#",
|
||||
"#.##...#...",
|
||||
"#...##....#",
|
||||
".#..#...#.#",
|
||||
});
|
||||
|
||||
Assert.Equal("336", result);
|
||||
}
|
||||
Assert.Equal("336", result);
|
||||
}
|
||||
}
|
||||
@@ -1,78 +1,75 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day04_Tests
|
||||
{
|
||||
public class Day04_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day04();
|
||||
var day = new Day04();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd",
|
||||
"byr:1937 iyr:2017 cid:147 hgt:183cm",
|
||||
"",
|
||||
"iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884",
|
||||
"hcl:#cfa07d byr:1929",
|
||||
"",
|
||||
"hcl:#ae17e1 iyr:2013",
|
||||
"eyr:2024",
|
||||
"ecl:brn pid:760753108 byr:1931",
|
||||
"hgt:179cm",
|
||||
"",
|
||||
"hcl:#cfa07d eyr:2025 pid:166559648",
|
||||
"iyr:2011 ecl:brn hgt:59in",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"ecl:gry pid:860033327 eyr:2020 hcl:#fffffd",
|
||||
"byr:1937 iyr:2017 cid:147 hgt:183cm",
|
||||
"",
|
||||
"iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884",
|
||||
"hcl:#cfa07d byr:1929",
|
||||
"",
|
||||
"hcl:#ae17e1 iyr:2013",
|
||||
"eyr:2024",
|
||||
"ecl:brn pid:760753108 byr:1931",
|
||||
"hgt:179cm",
|
||||
"",
|
||||
"hcl:#cfa07d eyr:2025 pid:166559648",
|
||||
"iyr:2011 ecl:brn hgt:59in",
|
||||
});
|
||||
|
||||
Assert.Equal("2", result);
|
||||
}
|
||||
Assert.Equal("2", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__ExampleInvalid()
|
||||
{
|
||||
var day = new Day04();
|
||||
[Fact]
|
||||
public void ResolvePart2__ExampleInvalid()
|
||||
{
|
||||
var day = new Day04();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"eyr:1972 cid:100",
|
||||
"hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926",
|
||||
"",
|
||||
"iyr:2019",
|
||||
"hcl:#602927 eyr:1967 hgt:170cm",
|
||||
"ecl:grn pid:012533040 byr:1946",
|
||||
"",
|
||||
"hcl:dab227 iyr:2012",
|
||||
"ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277",
|
||||
"",
|
||||
"hgt:59cm ecl:zzz",
|
||||
"eyr:2038 hcl:74454a iyr:2023",
|
||||
"pid:3556412378 byr:2007",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"eyr:1972 cid:100",
|
||||
"hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926",
|
||||
"",
|
||||
"iyr:2019",
|
||||
"hcl:#602927 eyr:1967 hgt:170cm",
|
||||
"ecl:grn pid:012533040 byr:1946",
|
||||
"",
|
||||
"hcl:dab227 iyr:2012",
|
||||
"ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277",
|
||||
"",
|
||||
"hgt:59cm ecl:zzz",
|
||||
"eyr:2038 hcl:74454a iyr:2023",
|
||||
"pid:3556412378 byr:2007",
|
||||
});
|
||||
|
||||
Assert.Equal("0", result);
|
||||
}
|
||||
Assert.Equal("0", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__ExampleValid()
|
||||
{
|
||||
var day = new Day04();
|
||||
[Fact]
|
||||
public void ResolvePart2__ExampleValid()
|
||||
{
|
||||
var day = new Day04();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980",
|
||||
"hcl:#623a2f",
|
||||
"",
|
||||
"eyr:2029 ecl:blu cid:129 byr:1989",
|
||||
"iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm",
|
||||
"",
|
||||
"hcl:#888785",
|
||||
"hgt:164cm byr:2001 iyr:2015 cid:88",
|
||||
"pid:545766238 ecl:hzl",
|
||||
"eyr:2022",
|
||||
"",
|
||||
"iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980",
|
||||
"hcl:#623a2f",
|
||||
"",
|
||||
"eyr:2029 ecl:blu cid:129 byr:1989",
|
||||
"iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm",
|
||||
"",
|
||||
"hcl:#888785",
|
||||
"hgt:164cm byr:2001 iyr:2015 cid:88",
|
||||
"pid:545766238 ecl:hzl",
|
||||
"eyr:2022",
|
||||
"",
|
||||
"iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719",
|
||||
});
|
||||
|
||||
Assert.Equal("4", result);
|
||||
}
|
||||
Assert.Equal("4", result);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +1,52 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day05_Tests
|
||||
{
|
||||
public class Day05_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example1()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example1()
|
||||
{
|
||||
var day = new Day05();
|
||||
var day = new Day05();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"FBFBBFFRLR",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"FBFBBFFRLR",
|
||||
});
|
||||
|
||||
Assert.Equal("357", result);
|
||||
}
|
||||
Assert.Equal("357", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example2()
|
||||
{
|
||||
var day = new Day05();
|
||||
[Fact]
|
||||
public void ResolvePart1__Example2()
|
||||
{
|
||||
var day = new Day05();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"BFFFBBFRRR",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"BFFFBBFRRR",
|
||||
});
|
||||
|
||||
Assert.Equal("567", result);
|
||||
}
|
||||
Assert.Equal("567", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example3()
|
||||
{
|
||||
var day = new Day05();
|
||||
[Fact]
|
||||
public void ResolvePart1__Example3()
|
||||
{
|
||||
var day = new Day05();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"FFFBBBFRRR",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"FFFBBBFRRR",
|
||||
});
|
||||
|
||||
Assert.Equal("119", result);
|
||||
}
|
||||
Assert.Equal("119", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart1__Example4()
|
||||
{
|
||||
var day = new Day05();
|
||||
[Fact]
|
||||
public void ResolvePart1__Example4()
|
||||
{
|
||||
var day = new Day05();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"BBFFBBFRLL",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"BBFFBBFRLL",
|
||||
});
|
||||
|
||||
Assert.Equal("820", result);
|
||||
}
|
||||
Assert.Equal("820", result);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +1,56 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day06_Tests
|
||||
{
|
||||
public class Day06_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day06();
|
||||
var day = new Day06();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"abc",
|
||||
"",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"",
|
||||
"ab",
|
||||
"ac",
|
||||
"",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"",
|
||||
"b",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"abc",
|
||||
"",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"",
|
||||
"ab",
|
||||
"ac",
|
||||
"",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"",
|
||||
"b",
|
||||
});
|
||||
|
||||
Assert.Equal("11", result);
|
||||
}
|
||||
Assert.Equal("11", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day06();
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day06();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"abc",
|
||||
"",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"",
|
||||
"ab",
|
||||
"ac",
|
||||
"",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"",
|
||||
"b",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"abc",
|
||||
"",
|
||||
"a",
|
||||
"b",
|
||||
"c",
|
||||
"",
|
||||
"ab",
|
||||
"ac",
|
||||
"",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"a",
|
||||
"",
|
||||
"b",
|
||||
});
|
||||
|
||||
Assert.Equal("6", result);
|
||||
}
|
||||
Assert.Equal("6", result);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,42 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day07_Tests
|
||||
{
|
||||
public class Day07_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day07();
|
||||
var day = new Day07();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"light red bags contain 1 bright white bag, 2 muted yellow bags.",
|
||||
"dark orange bags contain 3 bright white bags, 4 muted yellow bags.",
|
||||
"bright white bags contain 1 shiny gold bag.",
|
||||
"muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.",
|
||||
"shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.",
|
||||
"dark olive bags contain 3 faded blue bags, 4 dotted black bags.",
|
||||
"vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.",
|
||||
"faded blue bags contain no other bags.",
|
||||
"dotted black bags contain no other bags.",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"light red bags contain 1 bright white bag, 2 muted yellow bags.",
|
||||
"dark orange bags contain 3 bright white bags, 4 muted yellow bags.",
|
||||
"bright white bags contain 1 shiny gold bag.",
|
||||
"muted yellow bags contain 2 shiny gold bags, 9 faded blue bags.",
|
||||
"shiny gold bags contain 1 dark olive bag, 2 vibrant plum bags.",
|
||||
"dark olive bags contain 3 faded blue bags, 4 dotted black bags.",
|
||||
"vibrant plum bags contain 5 faded blue bags, 6 dotted black bags.",
|
||||
"faded blue bags contain no other bags.",
|
||||
"dotted black bags contain no other bags.",
|
||||
});
|
||||
|
||||
Assert.Equal("4", result);
|
||||
}
|
||||
Assert.Equal("4", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day07();
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day07();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"shiny gold bags contain 2 dark red bags.",
|
||||
"dark red bags contain 2 dark orange bags.",
|
||||
"dark orange bags contain 2 dark yellow bags.",
|
||||
"dark yellow bags contain 2 dark green bags.",
|
||||
"dark green bags contain 2 dark blue bags.",
|
||||
"dark blue bags contain 2 dark violet bags.",
|
||||
"dark violet bags contain no other bags.",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"shiny gold bags contain 2 dark red bags.",
|
||||
"dark red bags contain 2 dark orange bags.",
|
||||
"dark orange bags contain 2 dark yellow bags.",
|
||||
"dark yellow bags contain 2 dark green bags.",
|
||||
"dark green bags contain 2 dark blue bags.",
|
||||
"dark blue bags contain 2 dark violet bags.",
|
||||
"dark violet bags contain no other bags.",
|
||||
});
|
||||
|
||||
Assert.Equal("126", result);
|
||||
}
|
||||
Assert.Equal("126", result);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +1,44 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day08_Tests
|
||||
{
|
||||
public class Day08_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day08();
|
||||
var day = new Day08();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"nop +0",
|
||||
"acc +1",
|
||||
"jmp +4",
|
||||
"acc +3",
|
||||
"jmp -3",
|
||||
"acc -99",
|
||||
"acc +1",
|
||||
"jmp -4",
|
||||
"acc +6",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"nop +0",
|
||||
"acc +1",
|
||||
"jmp +4",
|
||||
"acc +3",
|
||||
"jmp -3",
|
||||
"acc -99",
|
||||
"acc +1",
|
||||
"jmp -4",
|
||||
"acc +6",
|
||||
});
|
||||
|
||||
Assert.Equal("5", result);
|
||||
}
|
||||
Assert.Equal("5", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day08();
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day08();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"nop +0",
|
||||
"acc +1",
|
||||
"jmp +4",
|
||||
"acc +3",
|
||||
"jmp -3",
|
||||
"acc -99",
|
||||
"acc +1",
|
||||
"jmp -4",
|
||||
"acc +6",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"nop +0",
|
||||
"acc +1",
|
||||
"jmp +4",
|
||||
"acc +3",
|
||||
"jmp -3",
|
||||
"acc -99",
|
||||
"acc +1",
|
||||
"jmp -4",
|
||||
"acc +6",
|
||||
});
|
||||
|
||||
Assert.Equal("8", result);
|
||||
}
|
||||
Assert.Equal("8", result);
|
||||
}
|
||||
}
|
||||
@@ -1,69 +1,66 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day09_Tests
|
||||
{
|
||||
public class Day09_Tests
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day09();
|
||||
var day = new Day09();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"35",
|
||||
"20",
|
||||
"15",
|
||||
"25",
|
||||
"47",
|
||||
"40",
|
||||
"62",
|
||||
"55",
|
||||
"65",
|
||||
"95",
|
||||
"102",
|
||||
"117",
|
||||
"150",
|
||||
"182",
|
||||
"127",
|
||||
"219",
|
||||
"299",
|
||||
"277",
|
||||
"309",
|
||||
"576",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"35",
|
||||
"20",
|
||||
"15",
|
||||
"25",
|
||||
"47",
|
||||
"40",
|
||||
"62",
|
||||
"55",
|
||||
"65",
|
||||
"95",
|
||||
"102",
|
||||
"117",
|
||||
"150",
|
||||
"182",
|
||||
"127",
|
||||
"219",
|
||||
"299",
|
||||
"277",
|
||||
"309",
|
||||
"576",
|
||||
});
|
||||
|
||||
Assert.Equal("127", result);
|
||||
}
|
||||
Assert.Equal("127", result);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day09();
|
||||
[Fact]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day09();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"35",
|
||||
"20",
|
||||
"15",
|
||||
"25",
|
||||
"47",
|
||||
"40",
|
||||
"62",
|
||||
"55",
|
||||
"65",
|
||||
"95",
|
||||
"102",
|
||||
"117",
|
||||
"150",
|
||||
"182",
|
||||
"127",
|
||||
"219",
|
||||
"299",
|
||||
"277",
|
||||
"309",
|
||||
"576",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"35",
|
||||
"20",
|
||||
"15",
|
||||
"25",
|
||||
"47",
|
||||
"40",
|
||||
"62",
|
||||
"55",
|
||||
"65",
|
||||
"95",
|
||||
"102",
|
||||
"117",
|
||||
"150",
|
||||
"182",
|
||||
"127",
|
||||
"219",
|
||||
"299",
|
||||
"277",
|
||||
"309",
|
||||
"576",
|
||||
});
|
||||
|
||||
Assert.Equal("62", result);
|
||||
}
|
||||
Assert.Equal("62", result);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,42 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day10_Tests
|
||||
{
|
||||
public class Day10_Tests
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day10();
|
||||
var day = new Day10();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day09();
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day09();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
}
|
||||
@@ -1,45 +1,42 @@
|
||||
using Xunit;
|
||||
namespace AdventOfCode2020.Tests;
|
||||
|
||||
namespace AdventOfCode2020.Tests
|
||||
public class Day11_Tests
|
||||
{
|
||||
public class Day11_Tests
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart1__Example()
|
||||
{
|
||||
var day = new Day11();
|
||||
var day = new Day11();
|
||||
|
||||
string result = day.ResolvePart1(new string[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
string result = day.ResolvePart1(new[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day11();
|
||||
[Fact(Skip="Not implemented")]
|
||||
public void ResolvePart2__Example()
|
||||
{
|
||||
var day = new Day11();
|
||||
|
||||
string result = day.ResolvePart2(new string[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
string result = day.ResolvePart2(new[] {
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
"XXXXXXXXXXXXXXX",
|
||||
});
|
||||
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
Assert.Equal("YYY", result);
|
||||
}
|
||||
}
|
||||
1
AdventOfCode2020.Tests/Usings.cs
Normal file
1
AdventOfCode2020.Tests/Usings.cs
Normal file
@@ -0,0 +1 @@
|
||||
global using Xunit;
|
||||
Reference in New Issue
Block a user