public void test_solution_givenNonEmptyArray_returnsStartingPosition(int[] given, int expected) { var target = new MinAvgTwoSlice(); var actual = target.solution(given); Assert.AreEqual(expected, actual); }
public void FindShouldReturnStartPositionOfMinAvgWhenGivenNonEmptyA(int[] a, int expected) { MinAvgTwoSlice finder = new MinAvgTwoSlice(); int actual = finder.Find(a); Assert.AreEqual(expected, actual); }
public void TestOne() { int[] testArray = new int[] { 4, 2, 2, 5, 1, 5, 8 }; MinAvgTwoSlice sut = new MinAvgTwoSlice(); var result = sut.solution(testArray); result.Should().Be(1); }
public void MinAvgTwoSliceSolutionTest() { var sliceAverage = new MinAvgTwoSlice(); int[] array = { 4, 2, 2, 5, 1, 5, 8 }; int result = sliceAverage.Solve(array); Assert.AreEqual(1, result); }
public void MinAvgTwoSlice_Should_Process_Simple_Array() { MinAvgTwoSlice subject = new MinAvgTwoSlice(); int expectedResult = 1; int[] array = { 4, 2, 2, 5, 1, 5, 8 }; int result = subject.solution(array); Assert.Equal(expectedResult, result); }
public void Solution_SmallArray_Correct() { //Arrange - Given var array = new int[] { 4, 2, 2, 5, 1, 5, 8 }; //Act - When var result = MinAvgTwoSlice.Solution(array); //Assert - Then var expectedResult = 1; Assert.Equal(expectedResult, result); }
public void MinAvgTwoSliceTest() { Random rnd = new Random((int)DateTime.Now.Ticks); int min = -10000; int max = 10000; for (int i = 0; i < 10000; i++) { int[] at = Enumerable.Repeat(0, rnd.Next(2, 101)).Select(i2 => rnd.Next(min, max + 1)).ToArray(); int t1 = MinAvgTwoSlice.solution(at); int t2 = MinAvgTwoSlice.solution1(at); Assert.AreEqual(t1, t2, 0, $"Result: [ex:{t2} ,go: {t1}]"); } }
public void TestTwo() { Random rand = new Random(); int min = -10000; int max = 10000; int[] testArray = new int[1000]; for (int i = 0; i < testArray.Length; i++) { testArray[i] = rand.Next(min, max); } MinAvgTwoSlice sut = new MinAvgTwoSlice(); var result = sut.solution(testArray); result.Should().Be(1); }
public void GetPrefixSumTest(int[] a, int[] expectedOutput) { var prefixSum = new MinAvgTwoSlice().GetPrefixSum(a); Assert.Equal(expectedOutput, prefixSum); }
public int MinAvgTwoSliceTestBasic(int [] A) { return(MinAvgTwoSlice.Solution(A)); }
public void MinAvgTwoSliceSolutionTestWithNegativeValues() { MinAvgTwoSlice testMinAvgTwoSlice = new MinAvgTwoSlice(); int[] arrayTest = new int[] { -3, -5, -8, -4, -10 }; Assert.AreEqual(2, testMinAvgTwoSlice.Solution(arrayTest)); }
public void MinAvgTwoSliceSolutionTest() { MinAvgTwoSlice testMinAvgTwoSlice = new MinAvgTwoSlice(); int[] arrayTest = new int[] { 4,2,2,5,1,5,8 }; Assert.AreEqual(1, testMinAvgTwoSlice.Solution(arrayTest)); }
public void Initialize() { _minAvgTwoSlice = new MinAvgTwoSlice(); }