Exemple #1
0
        public void SameValues_RemainIntact()
        {
            var input    = GeneratePowers(100, () => 101, () => 101);
            var expected = (Power[])input.Clone();
            var sut      = new PowersSorter();

            sut.Sort(input);

            input.Should().Equal(expected);
        }
Exemple #2
0
        public void SameBase_ExponentsGrow()
        {
            var random = new Random(12345);
            var input  = GeneratePowers(100, () => 999, () => random.Next(100, 10000));
            var sut    = new PowersSorter();

            sut.Sort(input);

            input.Select(x => x.Exponent).Should().BeInAscendingOrder();
        }
Exemple #3
0
        public void RandomSmallInput_VerifiesAccuratelly()
        {
            var random = new Random(12345);
            var input  = GeneratePowers(100, () => random.Next(2, 8), () => random.Next(2, 8));
            var copy   = input.ComputePowers().ToArray();

            Array.Sort(copy);

            var sut = new PowersSorter();

            sut.Sort(input);

            input.ComputePowers().ShouldAllBeEquivalentTo(copy);
        }
Exemple #4
0
        public void EmptySet_DoesNotFail()
        {
            var sut = new PowersSorter();

            sut.Sort(new Power[] { });
        }