public void Run2() { SimpleData simple = new SimpleData(); var data = simple.GetOrderedArray(10); simple.Shuffle(data); foreach (var item in data) { Console.WriteLine(item); } }
public void MaxTest() { SimpleAlgorithm simple = new SimpleAlgorithm(); SimpleData data = new SimpleData(); var nums = data.GetOrderedArray(10); data.Shuffle(nums); var result = simple.Max(nums); Assert.AreEqual(9, result.Item2); }
public void SuffleTest() { SimpleData simpleData = new SimpleData(); var result1 = simpleData.GetOrderedArray(10); var result2 = simpleData.GetOrderedArray(10); simpleData.Shuffle(result2); bool isSame = true; for (int i = 0; i < 10; i++) { isSame = isSame && (result1[i] == result2[2]); } Assert.IsFalse(isSame); }
public void FindSecondMaxTest() { SimpleAlgorithm simple = new SimpleAlgorithm(); int[] nums = new int[100]; for (int i = 0; i < 100; i++) { nums[i] = i + 1; } SimpleData data = new SimpleData(); data.Shuffle(nums); var result = simple.FindSecondMax(nums); int expected = 99; Assert.AreEqual(expected, result); }