public void InverseCaptchaPartTwo_PairsOfRepeatingDigits() { // act var result = InverseCaptcha.CalculateInverseCaptchaPartTwo("1212"); // assert Assert.AreEqual(6, result); }
public void InverseCaptcha_AllRepeatingDigits() { // act var result = InverseCaptcha.CalculateInverseCaptcha("1111"); // assert Assert.AreEqual(4, result); }
public void InverseCaptchaPartTwo_TrioOfRepeatingDigits() { // act var result = InverseCaptcha.CalculateInverseCaptchaPartTwo("123123"); // assert Assert.AreEqual(12, result); }
public void InverseCaptchaPartTwo_SingleRepeatingSet() { // act var result = InverseCaptcha.CalculateInverseCaptchaPartTwo("123425"); // assert Assert.AreEqual(4, result); }
public void InverseCaptcha_PairsOfRepeatingDigits() { // act var result = InverseCaptcha.CalculateInverseCaptcha("1122"); // assert Assert.AreEqual(3, result); }
public void InverseCaptchaPartTwo_OneDigitRepeatedFourTimes() { // act var result = InverseCaptcha.CalculateInverseCaptchaPartTwo("12131415"); // assert Assert.AreEqual(4, result); }
public void ShouldReturnCorrectValuesForSolve1(string input, int expected) { var reader = new StringReader(input); var sum = new InverseCaptcha().Solve1(reader); Assert.Equal(expected, sum); }
public void InverseCaptchaPartTwo_NoRepeatingDigits() { // act var result = InverseCaptcha.CalculateInverseCaptchaPartTwo("1221"); // assert Assert.AreEqual(0, result); }
public void InverseCaptcha_RepeatingDigitAtEnd() { // act var result = InverseCaptcha.CalculateInverseCaptcha("91212129"); // assert Assert.AreEqual(9, result); }
public void ExecutePart2_Always_ReturnsCorrectResult(string inputString, int expectedResult) { var inputEnumerable = from a in inputString.ToCharArray() select int.Parse(a.ToString()); var inputArray = inputEnumerable.ToArray(); var sut = new InverseCaptcha(); var result = sut.EvaluatePart2(inputArray); result.ShouldBe(expectedResult); }
static void Main(string[] args) { Console.WriteLine($"Day1 Answer: {InverseCaptcha.CalcSum()}"); Console.WriteLine($"Day1 Part2 Answer: {InverseCaptcha.CalcSumPart2()}"); var day2InputPuzzle = System.IO.File.ReadAllText("Day2\\InputPuzzleDay2.txt"); Console.WriteLine($"Day2 Answer: {CorruptionChecksum.CalculateCheckSum(day2InputPuzzle)}"); Console.WriteLine($"Day1 Part2 Answer: {CorruptionChecksum.CalculateCheckSum_Part2(day2InputPuzzle)}"); Console.WriteLine($"Day3 Answer: {SpiralMemory.CalculateSteps(289326)}"); if (Debugger.IsAttached) { Console.ReadKey(); } }
static void Main(string[] args) { var inverseCaptcha = new InverseCaptcha(); var day1resultA = inverseCaptcha.Solve1(new StringReader(Day1Input)); Console.WriteLine($"Day 1A result: {day1resultA}"); var day1resultB = inverseCaptcha.Solve2(Day1Input); Console.WriteLine($"Day 1B result: {day1resultB}"); var corruptionChecksumCalculator = new CorruptionChecksumCalculator(); var day2Aresult = corruptionChecksumCalculator.Calculate(Day2Input); Console.WriteLine($"Day 2 result: {day2Aresult}"); var day2Bresult = corruptionChecksumCalculator.GetSumOfEvenlyDivisibleValues(Day2Input); Console.WriteLine($"Day 2 result: {day2Bresult}"); }
public override void Run() { Console.WriteLine("Day 1"); var input = GetInput(); Console.WriteLine("Part 1"); var captcha = new InverseCaptcha(new NextDigit()); var result = captcha.Calculate(input); Console.WriteLine($"Result: {result}"); Console.WriteLine("Part 2"); captcha = new InverseCaptcha(new HalfwayAroundDigit()); result = captcha.Calculate(input); Console.WriteLine($"Result: {result}"); Console.WriteLine(); }
public void Setup() { ClassUnderTest = new InverseCaptcha(); }
public void ExamplesPart2(string input, long expected) { InverseCaptcha.CalcSumPart2(input).Should().Be(expected); }
static void Main(string[] args) { var day = new InverseCaptcha(); Console.WriteLine(day.Run()); }
public void PartTwo(int expected, string value) { Assert.Equal(expected, InverseCaptcha. findSumOfDigitsMatchHalfDigit(value)); }
public void PuzzlePartA() { Assert.Equal(1171, InverseCaptcha. findSumOfDigitsMatchNextDigit(input)); }
public void PuzzlePartB() { Assert.Equal(1024, InverseCaptcha. findSumOfDigitsMatchHalfDigit(input)); }
// ReSharper disable once InconsistentNaming public void With_Input_X_Answer_Is_Y(string input, int expectedAnswer) { var actualAnswer = InverseCaptcha.CalculateAnswer(input); Assert.Equal(actualAnswer, expectedAnswer); }
public void SetupBase() { Subject = new InverseCaptcha(DigitFinder); }