コード例 #1
0
        public void BricksNumber_SimpleExample_7()
        {
            var heights      = new int[] { 8, 8, 5, 7, 9, 8, 7, 4, 8 };
            var solver       = new StoneWall();
            var bricksNumber = solver.BricksNumber(heights);

            bricksNumber.Should().Be(7);
        }
コード例 #2
0
        public void BricksNumber_DoubleHill_5()
        {
            var heights = new[] { 7, 9, 9, 8, 8, 7, 7, 9, 9, 8, 8, 7 };
            var solver  = new StoneWall();

            var bricksNumber = solver.BricksNumber(heights);

            bricksNumber.Should().Be(5);
        }
コード例 #3
0
        public void BricksNumber_StepsUp_3()
        {
            var heights = new[] { 7, 7, 7, 8, 8, 8, 9, 9, 9 };
            var solver  = new StoneWall();

            var bricksNumber = solver.BricksNumber(heights);

            bricksNumber.Should().Be(3);
        }
コード例 #4
0
        public void BricksNumber_AllTheSame_1()
        {
            var heightsNumber = 10;
            var heights       = Enumerable.Range(1, heightsNumber).Select(n => heightsNumber).ToArray();
            var solver        = new StoneWall();

            var bricksNumber = solver.BricksNumber(heights);

            bricksNumber.Should().Be(1);
        }
コード例 #5
0
        public void BricksNumber_MonotonicDecrease_AmountOfHeights()
        {
            var heightsNumber = 10;
            var heights       = Enumerable.Range(1, heightsNumber).Select(n => heightsNumber - n).ToArray();
            var solver        = new StoneWall();

            var bricksNumber = solver.BricksNumber(heights);

            bricksNumber.Should().Be(heightsNumber);
        }