Code cleanup

This commit is contained in:
2023-12-02 18:27:00 +01:00
parent 4d8bfbb377
commit 4b3d0fd0b6
78 changed files with 6814 additions and 6950 deletions

View File

@@ -1,102 +1,100 @@
using System;
using Xunit;
namespace AdventOfCode2018.Tests
namespace AdventOfCode2018.Tests;
public class Day10_Tests
{
public class Day10_Tests
[Fact]
public void ResolvePart1__Test()
{
[Fact]
public void ResolvePart1__Test()
{
Day10 day = new Day10 { Width = 12, Height = 10 };
Day10 day = new() { Width = 12, Height = 10 };
string result = day.ResolvePart1(new string[] {
"position=< 9, 1> velocity=< 0, 2>",
"position=< 7, 0> velocity=<-1, 0>",
"position=< 3, -2> velocity=<-1, 1>",
"position=< 6, 10> velocity=<-2, -1>",
"position=< 2, -4> velocity=< 2, 2>",
"position=<-6, 10> velocity=< 2, -2>",
"position=< 1, 8> velocity=< 1, -1>",
"position=< 1, 7> velocity=< 1, 0>",
"position=<-3, 11> velocity=< 1, -2>",
"position=< 7, 6> velocity=<-1, -1>",
"position=<-2, 3> velocity=< 1, 0>",
"position=<-4, 3> velocity=< 2, 0>",
"position=<10, -3> velocity=<-1, 1>",
"position=< 5, 11> velocity=< 1, -2>",
"position=< 4, 7> velocity=< 0, -1>",
"position=< 8, -2> velocity=< 0, 1>",
"position=<15, 0> velocity=<-2, 0>",
"position=< 1, 6> velocity=< 1, 0>",
"position=< 8, 9> velocity=< 0, -1>",
"position=< 3, 3> velocity=<-1, 1>",
"position=< 0, 5> velocity=< 0, -1>",
"position=<-2, 2> velocity=< 2, 0>",
"position=< 5, -2> velocity=< 1, 2>",
"position=< 1, 4> velocity=< 2, 1>",
"position=<-2, 7> velocity=< 2, -2>",
"position=< 3, 6> velocity=<-1, -1>",
"position=< 5, 0> velocity=< 1, 0>",
"position=<-6, 0> velocity=< 2, 0>",
"position=< 5, 9> velocity=< 1, -2>",
"position=<14, 7> velocity=<-2, 0>",
"position=<-3, 6> velocity=< 2, -1>",
});
string result = day.ResolvePart1(new[] {
"position=< 9, 1> velocity=< 0, 2>",
"position=< 7, 0> velocity=<-1, 0>",
"position=< 3, -2> velocity=<-1, 1>",
"position=< 6, 10> velocity=<-2, -1>",
"position=< 2, -4> velocity=< 2, 2>",
"position=<-6, 10> velocity=< 2, -2>",
"position=< 1, 8> velocity=< 1, -1>",
"position=< 1, 7> velocity=< 1, 0>",
"position=<-3, 11> velocity=< 1, -2>",
"position=< 7, 6> velocity=<-1, -1>",
"position=<-2, 3> velocity=< 1, 0>",
"position=<-4, 3> velocity=< 2, 0>",
"position=<10, -3> velocity=<-1, 1>",
"position=< 5, 11> velocity=< 1, -2>",
"position=< 4, 7> velocity=< 0, -1>",
"position=< 8, -2> velocity=< 0, 1>",
"position=<15, 0> velocity=<-2, 0>",
"position=< 1, 6> velocity=< 1, 0>",
"position=< 8, 9> velocity=< 0, -1>",
"position=< 3, 3> velocity=<-1, 1>",
"position=< 0, 5> velocity=< 0, -1>",
"position=<-2, 2> velocity=< 2, 0>",
"position=< 5, -2> velocity=< 1, 2>",
"position=< 1, 4> velocity=< 2, 1>",
"position=<-2, 7> velocity=< 2, -2>",
"position=< 3, 6> velocity=<-1, -1>",
"position=< 5, 0> velocity=< 1, 0>",
"position=<-6, 0> velocity=< 2, 0>",
"position=< 5, 9> velocity=< 1, -2>",
"position=<14, 7> velocity=<-2, 0>",
"position=<-3, 6> velocity=< 2, -1>",
});
Assert.Equal(
Environment.NewLine + "............" +
Environment.NewLine + ".#...#..###." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#####...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#..###." +
Environment.NewLine + "............", result);
}
Assert.Equal(
Environment.NewLine + "............" +
Environment.NewLine + ".#...#..###." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#####...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#...#.." +
Environment.NewLine + ".#...#..###." +
Environment.NewLine + "............", result);
}
[Fact]
public void ResolvePart2__Test()
{
Day10 day = new Day10();
[Fact]
public void ResolvePart2__Test()
{
Day10 day = new();
string result = day.ResolvePart2(new string[] {
"position=< 9, 1> velocity=< 0, 2>",
"position=< 7, 0> velocity=<-1, 0>",
"position=< 3, -2> velocity=<-1, 1>",
"position=< 6, 10> velocity=<-2, -1>",
"position=< 2, -4> velocity=< 2, 2>",
"position=<-6, 10> velocity=< 2, -2>",
"position=< 1, 8> velocity=< 1, -1>",
"position=< 1, 7> velocity=< 1, 0>",
"position=<-3, 11> velocity=< 1, -2>",
"position=< 7, 6> velocity=<-1, -1>",
"position=<-2, 3> velocity=< 1, 0>",
"position=<-4, 3> velocity=< 2, 0>",
"position=<10, -3> velocity=<-1, 1>",
"position=< 5, 11> velocity=< 1, -2>",
"position=< 4, 7> velocity=< 0, -1>",
"position=< 8, -2> velocity=< 0, 1>",
"position=<15, 0> velocity=<-2, 0>",
"position=< 1, 6> velocity=< 1, 0>",
"position=< 8, 9> velocity=< 0, -1>",
"position=< 3, 3> velocity=<-1, 1>",
"position=< 0, 5> velocity=< 0, -1>",
"position=<-2, 2> velocity=< 2, 0>",
"position=< 5, -2> velocity=< 1, 2>",
"position=< 1, 4> velocity=< 2, 1>",
"position=<-2, 7> velocity=< 2, -2>",
"position=< 3, 6> velocity=<-1, -1>",
"position=< 5, 0> velocity=< 1, 0>",
"position=<-6, 0> velocity=< 2, 0>",
"position=< 5, 9> velocity=< 1, -2>",
"position=<14, 7> velocity=<-2, 0>",
"position=<-3, 6> velocity=< 2, -1>",
});
string result = day.ResolvePart2(new[] {
"position=< 9, 1> velocity=< 0, 2>",
"position=< 7, 0> velocity=<-1, 0>",
"position=< 3, -2> velocity=<-1, 1>",
"position=< 6, 10> velocity=<-2, -1>",
"position=< 2, -4> velocity=< 2, 2>",
"position=<-6, 10> velocity=< 2, -2>",
"position=< 1, 8> velocity=< 1, -1>",
"position=< 1, 7> velocity=< 1, 0>",
"position=<-3, 11> velocity=< 1, -2>",
"position=< 7, 6> velocity=<-1, -1>",
"position=<-2, 3> velocity=< 1, 0>",
"position=<-4, 3> velocity=< 2, 0>",
"position=<10, -3> velocity=<-1, 1>",
"position=< 5, 11> velocity=< 1, -2>",
"position=< 4, 7> velocity=< 0, -1>",
"position=< 8, -2> velocity=< 0, 1>",
"position=<15, 0> velocity=<-2, 0>",
"position=< 1, 6> velocity=< 1, 0>",
"position=< 8, 9> velocity=< 0, -1>",
"position=< 3, 3> velocity=<-1, 1>",
"position=< 0, 5> velocity=< 0, -1>",
"position=<-2, 2> velocity=< 2, 0>",
"position=< 5, -2> velocity=< 1, 2>",
"position=< 1, 4> velocity=< 2, 1>",
"position=<-2, 7> velocity=< 2, -2>",
"position=< 3, 6> velocity=<-1, -1>",
"position=< 5, 0> velocity=< 1, 0>",
"position=<-6, 0> velocity=< 2, 0>",
"position=< 5, 9> velocity=< 1, -2>",
"position=<14, 7> velocity=<-2, 0>",
"position=<-3, 6> velocity=< 2, -1>",
});
Assert.Equal("3", result);
}
Assert.Equal("3", result);
}
}