Example #1
0
        public void Test_DayTen_PartOne()
        {
            var testFile = Path.Combine(TestHelper.TestDir, "Day10.Input.txt");
            var map      = new AsteroidMap(testFile);
            var best     = map.GetBestAsteroid();

            Assert.IsTrue(best.Item2 == 319);
        }
Example #2
0
        public void ShouldCorrectlyGetPart1Solution()
        {
            AsteroidMap map      = new AsteroidMap(@"Inputs\Day10Input.txt");
            Asteroid    asteroid = map.GetBestAsteroid();

            Assert.Equal(280, asteroid.AsteroidsVisible);
            Assert.Equal(20, asteroid.X);
            Assert.Equal(18, asteroid.Y);
        }
Example #3
0
        public void ShouldCorrectlyGetPart2Solution()
        {
            AsteroidMap map      = new AsteroidMap(@"Inputs\Day10Input.txt");
            Asteroid    asteroid = map.GetBestAsteroid();

            Asteroid answer = map.GetOrderOfDestruction(asteroid).Skip(199).First();

            Assert.Equal(7, answer.X);
            Assert.Equal(6, answer.Y);
        }
        public void ShouldCorrectlyCalculateExample5()
        {
            AsteroidMap map = new AsteroidMap(@"Inputs\Day10Example5Input.txt");

            Asteroid asteroid = map.GetBestAsteroid();

            Assert.Equal(11, asteroid.X);
            Assert.Equal(13, asteroid.Y);
            Assert.Equal(210, asteroid.AsteroidsVisible);
        }
Example #5
0
 public void Test_KnownMaps()
 {
     foreach (var test in KnownMaps)
     {
         //< Make the map
         var map = new AsteroidMap(test.File);
         //< Get the best asteroid
         var best = map.GetBestAsteroid();
         //< Ensure we ain't f**k up
         Assert.IsTrue(best.Item1.Equals(test.Asteroid));
         Assert.IsTrue(best.Item2 == test.CountVisible);
     }
 }
Example #6
0
        public void Test_DayTen_PartTwo()
        {
            var testFile = Path.Combine(TestHelper.TestDir, "Day10.Input.txt");
            var map      = new AsteroidMap(testFile);
            var best     = map.GetBestAsteroid();

            //< Set the laser at the 'best' point and get the vapourization order
            var order = map.GetVapourizationOrder(best.Item1);

            //< Get the 'test' value
            var last      = order.Last();
            var testValue = last.X * 100.0 + last.Y;

            Assert.IsTrue(testValue == 517);
        }