Пример #1
0
        public void CountInversions_calculate_invariants_for_unsorted_array()
        {
            // arrange
            var array = new int[] { 2, 1, 3, 1, 2 };

            // act
            var count = InversionCounter.GetCount(array);

            // assert
            count.Should().Be(4);
        }
Пример #2
0
        public void CountInversions_returns_zero_for_sorted_array()
        {
            // arrange
            var array = new int[] { 1, 1, 1, 2, 2 };

            // act
            var count = InversionCounter.GetCount(array);

            // assert
            count.Should().Be(0);
        }