コード例 #1
0
        public void ShouldNotFindPeakGivenNoElements(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[0]);

            peek.Should().NotHaveValue();
        }
コード例 #2
0
        public void RandomTest01(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 1, 2, 3, 2, 1 });

            peek.Should().HaveValue();
            peek.Should().Be(3);
        }
コード例 #3
0
        public void ShouldFindPeekWhenMiddleIsLargestGiven3LengthArray(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 1, 2, 1 });

            peek.Should().HaveValue();
            peek.Should().Be(2);
        }
コード例 #4
0
        public void ShouldReturnNumberGivenTwoLengthArrayWithSameValues(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 2, 2 });

            peek.Should().HaveValue();
            peek.Should().Be(2);
        }
コード例 #5
0
        public void ShouldReturnNumberGivenSingleItmeInArray(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 1 });

            peek.Should().HaveValue();
            peek.Should().Be(1);
        }
コード例 #6
0
        public void RandomTest06(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 1, 2, 3, 4, 10, 9, 8, 7, 8, 9, 10, 4, 3, 2, 1, });

            peek.Should().HaveValue();

            var validPeeks = new int[] { 10 };

            validPeeks.Any(v => v == peek.Value).Should().BeTrue();
        }
コード例 #7
0
        public void RandomTest05(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            var peek = peakFinding1D.FindPeek(
                new int[] { 1, 4, 4, 6, 7, 6, 3, 3, 1 });

            peek.Should().HaveValue();

            var validPeeks = new int[] { 4, 7, 3 };

            validPeeks.Any(v => v == peek.Value).Should().BeTrue();
        }
コード例 #8
0
        public void ShouldReturnLargerNumberGivenTwoLenghtArray(
            PeakFinding1D.AlgoType algoType)
        {
            var peakFinding1D = new PeakFinding1D(algoType);

            int?peek;

            peek = peakFinding1D.FindPeek(
                new int[] { 1, 2 });

            peek.Should().HaveValue();
            peek.Should().Be(2);

            peek = peakFinding1D.FindPeek(
                new int[] { 2, 1 });

            peek.Should().HaveValue();
            peek.Should().Be(2);
        }