Пример #1
0
        public void CountingSheepAdvancedTest5()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 5, 10, 15 };
            int[] saturday = new int[] { 11, 23, 3, 4, 15 };
            NUnit.Framework.Assert.AreEqual(3, kata.LostSheep(friday, saturday, 89));
        }
Пример #2
0
        public void CountingSheepAdvancedTest6()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 3, 6, 9, 12 };
            int[] saturday = new int[] { 3, 2, 1, 2, 3, 1 };
            NUnit.Framework.Assert.AreEqual(2, kata.LostSheep(friday, saturday, 44));
        }
Пример #3
0
        public void CountingSheepAdvancedTest3()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 2, 5, 8 };
            int[] saturday = new int[] { 11, 23, 3, 4, 15, 112, 12, 4 };
            NUnit.Framework.Assert.AreEqual(156, kata.LostSheep(friday, saturday, 355));
        }
Пример #4
0
        public void CountingSheepAdvancedTest4()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 1, 1, 1, 2, 1, 2 };
            int[] saturday = new int[] { 2, 1, 2, 1, 2, 1 };
            NUnit.Framework.Assert.AreEqual(13, kata.LostSheep(friday, saturday, 30));
        }
Пример #5
0
        public void CountingSheepAdvancedTest1()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 11, 23, 3, 4, 15 };
            int[] saturday = new int[] { 7, 14, 9, 21, 15 };
            NUnit.Framework.Assert.AreEqual(178, kata.LostSheep(friday, saturday, 300));
        }
Пример #6
0
        public void CountingSheepAdvancedTest2()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 2, 7, 13, 17 };
            int[] saturday = new int[] { 23, 56, 44, 12, 1, 2, 1 };
            NUnit.Framework.Assert.AreEqual(77, kata.LostSheep(friday, saturday, 255));
        }
Пример #7
0
        public void CountingSheepBasicTest2()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 3, 1, 2 };
            int[] saturday = new int[] { 4, 5 };
            NUnit.Framework.Assert.AreEqual(6, kata.LostSheep(friday, saturday, 21));
        }
Пример #8
0
        public void CountingSheepBasicTest3()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 5, 1, 4 };
            int[] saturday = new int[] { 5, 4 };
            NUnit.Framework.Assert.AreEqual(10, kata.LostSheep(friday, saturday, 29));
        }
Пример #9
0
    static void Main(string[] args)
    {
        var s = new CountingSheep();

        s.CalcAllCases();

        s.OutputResult();
    }
Пример #10
0
        public void CountingSheepBasicTest1()
        {
            var kata = new CountingSheep();

            int[] friday   = new int[] { 1, 2 };
            int[] saturday = new int[] { 3, 4 };
            NUnit.Framework.Assert.AreEqual(5, kata.LostSheep(friday, saturday, 15));
        }
Пример #11
0
        public void CountingSheep_CountSheep_RandomTests()
        {
            var numbers = new bool[rnd.Next(0, 100)];

            for (int i = 0; i < numbers.Length; i++)
            {
                numbers[i] = rnd.Next(2) == 2;

                int expected = solution(numbers);
                int actual   = CountingSheep.CountSheep(numbers);
                Assert.AreEqual(expected, actual);
            }
        }
Пример #12
0
        public static void Main(string[] args)
        {
            var problem = new CountingSheep();

            problem.Solve(@"..\..\files\A-large.in");

            //var problem = new RevengeOfThePancakes();
            //problem.Solve(@"..\..\files\B-large.in");

            //var problem = new CoinJam();
            //problem.Solve(@"..\..\files\C-large.in");

            //var problem = new Fractiles();
            //problem.Solve(@"..\..\files\D-large.in");

            Console.ReadLine();
        }
Пример #13
0
        public void CountingSheep_CountSheep_NumberOfTruesInArrayReturned()
        {
            var sheeps = new bool[] { true, false, true };

            Assert.AreEqual(2, CountingSheep.CountSheep(sheeps));

            sheeps = new bool[] { true, false, true, true, false, true, true, false, true };

            Assert.AreEqual(6, CountingSheep.CountSheep(sheeps));

            sheeps = new bool[] { true, true, true, true, true, true, true, true, true };

            Assert.AreEqual(9, CountingSheep.CountSheep(sheeps));

            sheeps = new bool[] { false, false, false, false, false, false, false, false, false, false, false, false };

            Assert.AreEqual(0, CountingSheep.CountSheep(sheeps));
        }
Пример #14
0
        public void CountingSheepRandomTest()
        {
            var kata = new CountingSheep();
            int n1   = ran.Next(1, 50);
            int n2   = ran.Next(1, 50);
            int lost = ran.Next(1, 40);

            int[] friday   = new int[n1];
            int[] saturday = new int[n2];
            for (int iii = 0; iii < n1; iii++)
            {
                friday[iii] = ran.Next(1, 50);
            }
            for (int iii = 0; iii < n2; iii++)
            {
                saturday[iii] = ran.Next(1, 50);
            }
            int total = friday.Sum() + saturday.Sum() + lost;

            NUnit.Framework.Assert.AreEqual(lost, kata.LostSheep(friday, saturday, total));
        }
Пример #15
0
        public void CountingSheep_CountSheep_SampleTest()
        {
            var sheeps = new bool[] { true, false, true };

            Assert.AreEqual(2, CountingSheep.CountSheep(sheeps));
        }