public void AOC2016_16_Checksum(string input, string expected) { byte[] byteInput = input.Select(ch => ch == '1' ? (byte)1 : (byte)0).ToArray(); string actual = AOC2016_16.CalculateChecksum(byteInput, byteInput.Length); actual.Should().Be(expected); }
public void AOC2016_16_Transform(string input, string expected) { byte[] arr = input.Select(ch => ch == '1' ? (byte)1 : (byte)0).Concat(new byte[input.Length + 1]).ToArray(); int size = AOC2016_16.Transform(arr, input.Length); size.Should().Be(input.Length * 2 + 1); StringBuilder sb = new(); for (int i = 0; i < size; i++) { sb.Append(arr[i] == 1 ? '1' : '0'); } sb.ToString().Should().Be(expected); }
public void AOC2016_16_2_Actual() => Actual("01010100101011100", x => AOC2016_16.Solve(x, "35651584"), "16");
public void AOC2016_16_1_Actual() => Actual("10010010110011010", x => AOC2016_16.Solve(x, "272"), "16");
public void AOC2016_16_1_Sample() => Sample("01100", x => AOC2016_16.Solve(x, "20"), "16");