Beispiel #1
0
		private void RunAlgoTestFor(bool runEfficientAlgo, int[] candyArr, int expected, string msg)
		{
			CandySplitting target = new CandySplitting();
			int actual;
			actual = runEfficientAlgo ? target.RunEffificentAlgo(candyArr) : target.RunIneffificentAlgo(candyArr);
			Assert.AreEqual(expected, actual, msg);
		}
Beispiel #2
0
		/// <summary>
		/// Assumes IE is correct and tests E against it's output
		/// </summary>
		/// <param name="input"></param>
		private void RunEvsIEFor(int[] input, string msg)
		{
			CandySplitting ieff = new CandySplitting();
			CandySplitting target = new CandySplitting();
			int[] inputCopy = new int[input.Length];

			Array.Copy(input, inputCopy, input.Length);

			int expected = ieff.RunIneffificentAlgo(input);
			int actual = target.RunEffificentAlgo(inputCopy);

			Assert.AreEqual(expected, actual, msg + ":Efficient doesn't match InEfficient");
		}