public void TapeEquilibriumSolutionTest() { TapeEquilibrium testTape = new TapeEquilibrium(); int[] arrayTest = new int[] { 3, 1, 2, 4, 3 }; Assert.AreEqual(1, testTape.Solution(arrayTest)); }
public static void Test() { var A = new int[] { 1, 3, 4, 7, 9, -4000 }; var R = new TapeEquilibrium().Solution(A); Console.WriteLine("Result: " + R); }
public void Test() { TapeEquilibrium tape = new TapeEquilibrium(); int[] A = { 3, 1, 2, 4, 3 }; int min = tape.solution(A); Assert.AreEqual(1, min); int[] A2 = { 1, 1, 1, 1, 1 }; min = tape.solution(A2); Assert.AreEqual(1, min); int[] A3 = { 1, 1, 1, 1, 1, 1 }; min = tape.solution(A3); Assert.AreEqual(0, min); int[] A4 = { 20, 30 }; min = tape.solution(A4); Assert.AreEqual(10, min); int[] A5 = { 20 }; min = tape.solution(A5); Assert.AreEqual(20, min); }
public void Tests(int[] data, int expected) { TapeEquilibrium tp = new TapeEquilibrium(); var result = tp.Solution(data, data.Length); Assert.AreEqual(expected, result); }
public void MinimizeShouldReturnMinimalDiferenceWhenGivenNonEmptyArray(int[] a, int expected) { TapeEquilibrium minimizer = new TapeEquilibrium(); int actual = minimizer.Minimize(a); Assert.AreEqual(expected, actual); }
public void TestMethod2() { int[] input = { 5, 9, 10, 6, 3, 1, 8, 2, 7 }; int expected = 3; int result = TapeEquilibrium.Solution(input); Assert.AreEqual(expected, result); }
public void TestMethod1() { int[] input = { 3, 1, 2, 4, 3 }; int expected = 1; int result = TapeEquilibrium.Solution(input); Assert.AreEqual(expected, result); }
public void TapeEquilibriumSolutionTest() { var tape = new TapeEquilibrium(); int[] array = new int[] { 3, 1, 2, 4, 3 }; int result = tape.Solve(array); Assert.AreEqual(1, result); }
static void Main(string[] args) { BinaryGap.Test(); CyclicRotation.Test(); OddOccurrencesInArray.Test(); TapeEquilibrium.Test(); PermCheck.Test(); FrogRiverOne.Test(); MissingInteger.Test(); }
public void SolutionTest() { var solution = new TapeEquilibrium(); int[] A = new int[] { 3, 1, 2, 4, 3 }; int expected = 1; int actual = solution.Solution(A); Assert.AreEqual(expected, actual); }
public void TapeEquilibrium_Should_Process_Complex_Array() { TapeEquilibrium subject = new TapeEquilibrium(); int[] array = { 1000, 500, 3, 5, -1000 }; int result = subject.solution(array); Assert.Equal(1492, result); }
public void TapeEquilibrium_Should_Process_MaxNumbers_Array() { TapeEquilibrium subject = new TapeEquilibrium(); int[] array = { -1000, 1000 }; int result = subject.solution(array); Assert.Equal(2000, result); }
public void TapeEquilibrium_Should_Handle_Empty_Array() { TapeEquilibrium subject = new TapeEquilibrium(); int[] array = {}; int result = subject.solution(array); Assert.Equal(0, result); }
public void TapeEquilibrium_Should_Process_Negative_Array() { TapeEquilibrium subject = new TapeEquilibrium(); int[] array = { -3, -1, -2, -4, -3 }; int result = subject.solution(array); Assert.Equal(1, result); }
public void TapeEquilibrium_Should_Process_Simple_Array() { TapeEquilibrium subject = new TapeEquilibrium(); int[] array = { 3, 1, 2, 4, 3 }; int result = subject.solution(array); Assert.Equal(1, result); }
public void TestShortTapeSample() { var tapeEquilibriumSolver = new TapeEquilibrium(); List <int> entryArray = new List <int>() { 3, 1, 2, 4, 3 }; int solution = tapeEquilibriumSolver.solution(entryArray.ToArray()); Assert.AreEqual(solution, 1); }
public void Setup() { _binaryGap = new BinaryGap(); _arrayRotation = new ArrayRotation(); _unpairedElements = new UnpairedElements(); _frogJump = new FrogJump(); _permMissingElement = new PermMissingElement(); _tapeEquilibrium = new TapeEquilibrium(); _frogRiverOne = new FrogRiverOne(); _maxCounters = new MaxCounters(); _missingInteger = new MissingInteger(); }
public void Solution_SmallNumbers_Correct() { //Arrange - Given var array = new int[] { 3, 1, 2, 4, 3 }; //Act - When var result = TapeEquilibrium.Solution(array); //Assert - Then var expectedResult = 1; Assert.Equal(expectedResult, result); }
static void Main(string[] args) { /// CodeWars //Vasya_Clerk.Run(); /// Codility Lessons //BinaryGap.Run(); //CyclicRotation.Run(); //OddOccurrencesInArray.Run(); //FrogJmp.Run(); //PermMissingElem.Run(); TapeEquilibrium.Run(); /// LEETCODE CONTEST //FindTheDifference_389.Run(); //EliminationGame_390.Run(); //WiggleSequence_376.Run(); /// STRINGS //FindDuplicateLetters.Run(); //StringReverse.Run(); //StringPermutations.Run(); /// Math /* * ArmstrongNumbers.Run(); * CalculateFactorial.Run(); * FibonacciRun.Run(); * StandardDeviation.Run(); * IsPrime.Run(); */ /// PYRAMIDS /* * Pyramid01.Run(); * Pyramid02.Run(); * Pyramid03.Run(); * Pyramid04.Run(); * Pyramid05.Run(); */ /// SEARCH /* * LinearSearch.Run(); * BinarySearch.Run(); */ }
public void Case01() { // Arrange var algorithm = new TapeEquilibrium(); var A = new int[] { 3, 1, 2, 4, 3 }; // Act var result = algorithm.solution2(A); // Assert var expected = 1; Assert.Equal(expected, result); }
public void GetTapeEquilibriumMinimumExtremeLargeTest() { // Arrange TapeEquilibrium tapeEquilibrium = new TapeEquilibrium(); int[] tape = new int[] { 1082132608, 1082132608, 1082132608, 1082132608, 1082132608 }; // Action var current = tapeEquilibrium.GetTapeEquilibriumMinimum(tape); // Assert var expected = 1082132608; Assert.AreEqual(expected, current); }
public void GetTapeEquilibriumMinimumEmptyTest() { // Arrange TapeEquilibrium tapeEquilibrium = new TapeEquilibrium(); int[] tape = new int[] { }; // Action var current = tapeEquilibrium.GetTapeEquilibriumMinimum(tape); // Assert var expected = 0; Assert.AreEqual(expected, current); }
public void TestShortTape() { var tapeEquilibriumSolver = new TapeEquilibrium(); int maxElement = 10; List <int> entryArray = new List <int>(); for (int i = 0; i < maxElement; i++) { entryArray.Add(i + 1); } int solution = tapeEquilibriumSolver.solution(entryArray.ToArray()); Assert.AreEqual(solution, 1); }
public void Solution_LargeNumbers_Correct() { //Arrange - Given var maxrange = 10000; var array = new int[maxrange]; Random rnd = new Random(); for (int i = 0; i < array.Length; i++) { array[i] = rnd.Next(2, 100); } //Act - When var result = TapeEquilibrium.Solution(array); //Assert - Then Assert.IsType <int>(result); }
public void TestShortTapeSkipingOneElement() { var tapeEquilibriumSolver = new TapeEquilibrium(); int maxElement = 10; List <int> entryArray = new List <int>(); for (int i = 0; i < maxElement; i++) { entryArray.Add(i + 1); } var rnd = new Random(); int randomMissingElement = rnd.Next(1, maxElement); entryArray.RemoveAt(randomMissingElement - 1); int solution = tapeEquilibriumSolver.solution(entryArray.ToArray()); Assert.AreEqual(solution, 1); }
public void TapeEquilibrium_OneElement_Success() { Assert.AreEqual(1, TapeEquilibrium.Solution(new int[] { 1 })); }
public void TapeEquilibrium_EmptyArray_Success() { Assert.AreEqual(0, TapeEquilibrium.Solution(new int[] { })); }
public void TapeEquilibrium_NegativeValues_Success() { Assert.AreEqual(4, TapeEquilibrium.Solution(new int[] { -3, -1, -7, -4, -3 })); }
public void TapeEquilibrium_SmallArray_Success() { Assert.AreEqual(1, TapeEquilibrium.Solution(new int[] { 3, 1, 2, 4, 3 })); }
public void TapeEquilibrium_TwoElements_Success() { Assert.AreEqual(2, TapeEquilibrium.Solution(new int[] { 1, 3 })); }