コード例 #1
0
        public void SingleCase()
        {
            var inputString          = @"1
2 1
-2 6";
            var expectedOutputString = @"Case #1: 2";

            var outputStringsSeparated = expectedOutputString.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var io = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(outputStringsSeparated);
        }
コード例 #2
0
ファイル: CaseSolver.cs プロジェクト: Brondahl/GoogleCodeJam
        private static IEnumerable <string> ProcessCases(IEnumerable <List <string> > cases)
        {
            var currentCaseNumber = 0;

            foreach (var caseLines in cases)
            {
                currentCaseNumber++; //1-indexed.
                var parsedCase = new CaseInput(caseLines);
                var solver     = new CaseSolver(parsedCase);
                var result     = solver.Solve();

                var resultText = result.ToString();

                yield return($"Case #{currentCaseNumber}: {resultText}");
            }
        }
コード例 #3
0
        public void HarderExample()
        {
            var inputString          = @"4
2 1
-2 6
2 1
-10 10
1 1
0
3 1
2 -2 2";
            var expectedOutputString = @"Case #1: 3
Case #2: IMPOSSIBLE
Case #3: 0
Case #4: 2";

            var outputStringsSeparated = expectedOutputString.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            var io = new TestIOStub(inputString);

            CaseSolver.Run(io);

            io.Output.Should().BeEquivalentTo(outputStringsSeparated);
        }