Esempio n. 1
0
		public static void BadAssert (string input, CalcError output, string errorObject, [CallerLineNumber] int line = 0) {
			CalcResult result = new Calc ().Solve (input);

			if (result.Error != output) {
				Debug.WriteLine ("Line " + line + ": " + input + " = " + output.ToString () + ", GOT " + result.Error.ToString ());
			} else if (result.ErrorObject != errorObject) {
				Debug.WriteLine ("Line " + line + ": " + input + " = " + output.ToString () + " and " + errorObject + ", GOT " + result.Error.ToString () + " and " + result.ErrorObject);
			}
		}
Esempio n. 2
0
		public static void Assert (string input, double output, [CallerLineNumber] int line = 0) {
			CalcResult result = new Calc ().Solve (input);
			
			if (Math.Abs (result.Result - output) <= Math.Abs (result.Result * 0.00001)) {
				
			} else if (result.Error != CalcError.None) {
				Debug.WriteLine ("Line " + line + ": " + input + " = " + output + ", GOT " + result.Error);
			} else {
				Debug.WriteLine ("Line " + line + ": " + input + " = " + output + ", GOT " + result.Result);
			}
		}