public void InvalidInput() { Assert.Throws <ArgumentNullException>(() => InversePairsCount.GetCount(null)); Assert.Equal(0, InversePairsCount.GetCount(new int[0])); }
public void TestWithRandomArray() { int[] array = GenerateArray(5000); Assert.Equal(GetResultByBruteForce(array), InversePairsCount.GetCount(array)); }
public void TestWithSortedArray() { int[] array = GenerateArray(5000); Array.Sort(array); Assert.Equal(0, InversePairsCount.GetCount(array)); }
public void TestWithReverselySortedArray() { int[] array = GenerateArray(5000); Array.Sort(array, (int a, int b) => b - a); Assert.Equal(GetResultByBruteForce(array), InversePairsCount.GetCount(array)); }
public void ExampleOnBook() { Assert.Equal(5, InversePairsCount.GetCount(new[] { 7, 5, 6, 4 })); }