public void CanFindInversionsForLargeRandom() { var solver = new FindArrayInversionsCount(); var array = Enumerable.Range(0, 1000).ToArray(); array.Shuffle(); Assert.AreEqual(solver.CalcInversionsCountBrute(array), solver.CalcInversionsCount(array)); }
public void CanFindInversionsForRandom() { var solver = new FindArrayInversionsCount(); for (var size = 2; size < 100; size++) { var array = Enumerable.Range(1, size).ToArray(); array.Shuffle(); Console.WriteLine(size); var expected = solver.CalcInversionsCountBrute(array); var actual = solver.CalcInversionsCount(array.ToArray()); if (expected != actual) { Console.WriteLine(", ".Join(array)); } Assert.AreEqual(expected, actual); } }