Example #1
0
        public void FindJudgeTest()
        {
            var s = new Solution();

            int[][] trust;

            trust = Create2dArray(2, 1, 2);
            Assert.Equal(2, s.FindJudge(2, trust));

            trust = Create2dArray(2, 1, 3, 2, 3);
            Assert.Equal(3, s.FindJudge(3, trust));

            trust = Create2dArray(2, 1, 3, 2, 3, 3, 1);
            Assert.Equal(-1, s.FindJudge(3, trust));

            trust = Create2dArray(2, 1, 2, 2, 3);
            Assert.Equal(-1, s.FindJudge(3, trust));

            trust = Create2dArray(2, 1, 3, 1, 4, 2, 3, 2, 4, 4, 3);
            Assert.Equal(3, s.FindJudge(4, trust));

            trust = Create2dArray(0);
            Assert.Equal(1, s.FindJudge(1, trust));

            trust = Create2dArray(2, 1, 2, 3, 2, 1, 3, 4, 1, 3, 1, 2, 1, 2, 3, 4, 3, 4, 2, 3, 4, 2, 4);
            Assert.Equal(-1, s.FindJudge(4, trust));
        }