예제 #1
0
        public async Task Part1_Example1()
        {
            // Arrange
            var input   = @"<x=-8, y=-10, z=0>
<x=5, y=5, z=10>
<x=2, y=-7, z=3>
<x=9, y=-8, z=-3>";
            var subject = new TheNBodyProblem();
            await subject.ParseInputAsync(input.ToMemoryStream());

            // Act
            subject.Simulate(100);
            var result = subject.GetSystemEnergy();

            // Assert
            Assert.Equal(1940, result);
        }
예제 #2
0
        public async Task Part1_DetailedExample()
        {
            // Arrange
            var input   = @"<x=-1, y=0, z=2>
<x=2, y=-10, z=-7>
<x=4, y=-8, z=8>
<x=3, y=5, z=-1>";
            var subject = new TheNBodyProblem();
            await subject.ParseInputAsync(input.ToMemoryStream());

            // Act
            subject.Simulate(10);
            var result = subject.GetSystemEnergy();

            // Assert
            Assert.Equal(179, result);
        }