public void RotateArrayTest_Load() { var primeNumbers = Prime.PrimeNumber(200000); int[] input = primeNumbers.ToArray(); int[] actual = input.RotateLeft(primeNumbers.Count - 10); int[] expected = primeNumbers.Skip(primeNumbers.Count - 10).Union(primeNumbers.Take(primeNumbers.Count - 10)).ToArray(); CollectionAssert.AreEqual(expected, actual); }
public void LinearSearch_Test_Match() { int[] input = Prime.PrimeNumber(100).ToArray(); int itemToBeSearched = 97; Algorithm.Search.LinearSearch search = new Algorithm.Search.LinearSearch(input); int expectedIndex = 24; int actualIndex = search.Search(itemToBeSearched); Assert.AreEqual(expectedIndex, actualIndex); }
public void BinarySearch_Test_Match_Found() { int[] input = Prime.PrimeNumber(100).ToArray(); int itemToBeSearched = 11; Algorithm.Search.BinarySearch search = new Algorithm.Search.BinarySearch(input); int expectedIndex = 4; int actualIndex = search.Search(itemToBeSearched); Assert.AreEqual(expectedIndex, actualIndex); }
public void Sort_BubbleSortDesc_WhenArraySizeBig_Test() { var primeNumbers = Prime.PrimeNumber(200000); int[] arr = primeNumbers.ToArray(); BubbleSort sort = new BubbleSort(); int[] accual = sort.SortDesc(arr); primeNumbers.Reverse(); var expected = primeNumbers.ToArray(); CollectionAssert.AreEqual(expected, accual); }