Exemplo n.º 1
0
        public void TrackSystemMoveTest()
        {
            var ts = new Day13.TrackSystem(new string[] { "->--<-" });

            // Just make sure the system does not crash
            ts.NextTick(out string crashCoordinate);
            Assert.AreEqual("", crashCoordinate);
        }
Exemplo n.º 2
0
        public void TrackSystemInitializeTest()
        {
            var ts = new Day13.TrackSystem(new string[] {
                "/-\\",
                "| |",
                "| v",
                "\\-/"
            });

            Assert.AreEqual(10, ts.NumTracks);
            Assert.AreEqual(1, ts.NumCarts);
        }
Exemplo n.º 3
0
        public void TrackSystemCrashTest()
        {
            var ts = new Day13.TrackSystem(new string[] {
                "     v",
                "/----/",
                "^     "
            });
            string crashCoordinate;

            ts.NextTick(out crashCoordinate);
            Assert.AreEqual("", crashCoordinate);
            ts.NextTick(out crashCoordinate);
            Assert.AreEqual("", crashCoordinate);
            ts.NextTick(out crashCoordinate);
            Assert.AreEqual("", crashCoordinate);
            // Crash should happen in 3,1 eventhough 5,0 is the very first cart to move
            ts.NextTick(out crashCoordinate);
            Assert.AreEqual("3,1", crashCoordinate);
        }