public void Finds_index_location() { int[] input = new[] { 4, 8, 15, 16, 23, 42 }; int result = ArrayChallenges.BinarySearch(input, 15); Assert.Equal(2, result); }
public void Number_does_not_exist() { int[] input = new[] { 11, 22, 33, 44, 55, 66, 77 }; int result = ArrayChallenges.BinarySearch(input, 90); Assert.Equal(-1, result); }
public static void KeyNotFound() { int[] array = { 1, 2, 3, 13, 122, 900 }; int searchKey = 77; int result = ArrayChallenges.BinarySearch(array, searchKey); Assert.Equal(-1, result); }
public static void ThereIsAnIndex() { int[] array = { 1, 2, 3, 13, 122, 900 }; int searchKey = 3; int result = ArrayChallenges.BinarySearch(array, searchKey); Assert.Equal(2, result); }
public void FindCorrectIndexTest(int[] sortedArray, int searchKey, int expected) { //Given //When int result = ArrayChallenges.BinarySearch(sortedArray, searchKey); //Then Assert.Equal(expected, result); }
public void InsertIntoArray(int value, int[] input, int[] expected) { // Arrange is above with InlineData // Act int[] result = ArrayChallenges.InsertArrayShift(input, value); // Assert Assert.Equal(expected, result); }
public void ReverseNums(int[] input, int[] expected) { //arrange //act int[] output = ArrayChallenges.EsreverYarra(input); //assert Assert.Equal(expected, output); Assert.NotSame(input, output); }
public void shift(int[] input, int[] expected) { //arrange int numInput = 5; //act int[] result = ArrayChallenges.shiftedArr(input, numInput); //assert Assert.Equal(expected, result); }
public void can_shift_arrays(int[] input, int[] expected) { //Arrange: FROM INPUT int insertedNumber = 5; //Act int[] result = ArrayChallenges.ArrayShift(input, insertedNumber); //Assert Assert.Equal(expected, result); }
public static void dunGoof() { //arrange int[] arr = { 7, 14, 21, 28, 35, 42 }; int key = 77; //act int result = ArrayChallenges.BinSearch(arr, key); //assert Assert.Equal(-1, result); }
public void Can_insert_number_into_middle_of_odd_length_array() { int[] inputArray = { 5, 6, 7, 8, 9 }; int inputNumber = 10; int[] expected = { 5, 6, 7, 10, 8, 9 }; int[] result = ArrayChallenges.InsertShiftArray(inputArray, inputNumber); Assert.Equal(expected, result); }
[InlineData(4, new int[] { 1, 2, 3, 5, 6 }, new[] { 1, 2, 3, 4, 5, 6 })] // Odd (5) public void Can_shift(int value, int[] input, int[] expected) { // Arrange // from parameters // Act int[] result = ArrayChallenges.ArrayShift(input, value); // Assert Assert.Equal(expected, result); }
public void InsertIntoEvenLength() { //Arrange int[] input = new[] { 4, 5, 7, 8 }; //Act int[] result = ArrayChallenges.InsertArrayShift(input, 6); // Assert Assert.Equal(new[] { 4, 5, 6, 7, 8 }, result); }
public static void CenterOfTheEarth() { //arrange int[] arr = { 5, 10, 15, 20, 56, 420 }; int key = 15; //act int result = ArrayChallenges.BinSearch(arr, key); //assert Assert.Equal(3, result); }
public void Can_shift_into_even_length() { // Arrange int[] input = new[] { 1, 2, 4, 5 }; // Act int[] result = ArrayChallenges.ArrayShift(input, 3); // Assert Assert.Equal(new[] { 1, 2, 3, 4, 5 }, result); }
public void ReturnsIndexOfValueTest() { //Arrange int[] input = new[] { 4, 5, 7, 8, 9 }; int searchKey = 5; //Act int result = ArrayChallenges.BinarySearch(input, searchKey); // Assert Assert.Equal(1, result); }
public void ReverseAnArrayOfNumbers(int[] input, int[] expected) { //Arrange //Act int[] result = ArrayChallenges.ReverseArray(input); // Assert Assert.Equal(expected, result); // Not in-place reversal Assert.NotSame(input, result); }
public void Can_reverse_array_of_numbers(int[] input, int[] expected) { // Arrange // from input // Act int[] result = ArrayChallenges.ArrayReverse(input); // Assert Assert.Equal(expected, result); // Not in-place reversal Assert.NotSame(input, result); }
public void Can_reverse_empty_array() { // Arrange int[] input = new int[0]; // Act int[] result = ArrayChallenges.ArrayReverse(input); // Assert Assert.Empty(result); // Not in-place reversal Assert.NotSame(input, result); }
public void Can_Shift_Array_(int[] input, int[] expected) { //arrange int enteredNumber = 5; // act int[] result = ArrayChallenges.insertShiftArray(input, enteredNumber); //assert Assert.Equal(expected, result); }
public void NoMatchTest() { //Given int[] sortedArray = new int[] { 1, 2, 3, 4, 5, 6, 8, 9 }; int searchKey = 7; //When int result = ArrayChallenges.BinarySearch(sortedArray, searchKey); //Then int expected = -1; Assert.Equal(expected, result); }
public void Can_insert_number_into_middle_of_array() { // Arrange int[] inputArray = { 1, 2, 3, 4 }; int inputNumber = 5; int[] expected = { 1, 2, 5, 3, 4 }; // Act int[] result = ArrayChallenges.InsertShiftArray(inputArray, inputNumber); // Assert Assert.Equal(expected, result); }
public void ShiftTests() { //arrange int[] arrInp = new int[4] { 1, 2, 3, 4 }; int num = 5; int[] expected = new int[5] { 1, 2, 5, 3, 4 }; //act int[] result = ArrayChallenges.shiftedArr(arrInp, num); //assert Assert.Equal(expected, result); }
public void ShiftArrayTest() { // Arrange int[] inputArray = new int[4] { 1, 2, 3, 4 }; int inputNumber = 5; int[] expected = new int[5] { 1, 2, 5, 3, 4 }; // Act int[] result = ArrayChallenges.InsertShiftArray(inputArray, inputNumber); // Assert Assert.Equal(expected, result); }
public void can_reverse_array(int[] input, int[] expected) { int[] result = ArrayChallenges.ArrayReversed(input); Assert.Equal(expected, result); }
public void Returns_null_given_null() { int[] result = ArrayChallenges.ArrayShift(null, 1); Assert.Null(result); }