public void FindSystemsTotalEnergyAfter1000Steps() { var exampleLoader = new AlternateExampleLoader("Input.txt"); var system = exampleLoader.System; system.Simulate(1000); Assert.Equal(12053, system.TotalEnergy); }
public void ExampleHistoryRepeatItselfTest(string fileName, long expectedSteps) { var exampleLoader = new AlternateExampleLoader(fileName); var cycleDetector = new CycleDetector(exampleLoader.MoonsPositions); var cycleSteps = cycleDetector.FindCycleSteps(); Assert.Equal(expectedSteps, cycleSteps); }
public void Example2Test() { var exampleLoader = new AlternateExampleLoader("Example2.txt"); var system = exampleLoader.System; Assert.Equal(exampleLoader.ExpectedSystemStateOnStep[0], system.State); for (int i = 1; i <= 10; i++) { system.Simulate(10); Assert.Equal(exampleLoader.ExpectedSystemStateOnStep[i * 10], system.State); } Assert.Equal(1940, system.TotalEnergy); }
public void ExampleHistoryRepeatItselfTest(string fileName, long expectedSteps) { var exampleLoader = new AlternateExampleLoader(fileName); var system = exampleLoader.System; var initialState = system.State.ToArray(); long step = 0; do { step++; system.Simulate(); if (initialState.SequenceEqual(system.State)) { break; } } while (step <= expectedSteps + 1); Assert.Equal(expectedSteps, step); }