Пример #1
0
 private static bool errorCodesAreEqual(ErrorEval a, ErrorEval b)
 {
     if (a == b)
     {
         return true;
     }
     return a.ErrorCode == b.ErrorCode;
 }
Пример #2
0
 private void ConfirmPercentile(ValueEval percentile, ValueEval[] args, ErrorEval expectedError)
 {
     ValueEval result = invokePercentile(args, percentile);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(expectedError.ErrorCode, ((ErrorEval)result).ErrorCode);
 }
Пример #3
0
 public EvalEx(ErrorEval error)
 {
     _error = error;
 }
Пример #4
0
 public EvaluationException(ErrorEval errorEval)
 {
     _errorEval = errorEval;
 }
Пример #5
0
 private void ConfirmError(ValueEval xArray, ValueEval yArray, ErrorEval expectedError)
 {
     ConfirmError(SUM_SQUARES, xArray, yArray, expectedError);
     ConfirmError(DIFF_SQUARES, xArray, yArray, expectedError);
     ConfirmError(SUM_SQUARES_OF_DIFFS, xArray, yArray, expectedError);
 }
Пример #6
0
 private void ConfirmError(Function function, ValueEval xArray, ValueEval yArray, ErrorEval expectedError)
 {
     ValueEval result = invoke(function, xArray, yArray);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(expectedError.ErrorCode, ((ErrorEval)result).ErrorCode);
 }
Пример #7
0
 private void ConfirmAverage(ValueEval[] args, ErrorEval expectedError)
 {
     ValueEval result = InvokeAverage(args);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(expectedError.ErrorCode, ((ErrorEval)result).ErrorCode);
 }
Пример #8
0
 public EvaluationException(ErrorEval errorEval)
 {
     _errorEval = errorEval;
 }
Пример #9
0
 private void ConfirmMid(ValueEval text, ValueEval startPos, ValueEval numChars, ErrorEval expectedError)
 {
     ValueEval result = invokeMid(text, startPos, numChars);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(expectedError.ErrorCode, ((ErrorEval)result).ErrorCode);
 }
Пример #10
0
 private void ConfirmError(ValueEval xArray, ValueEval yArray, ErrorEval expectedError)
 {
     ConfirmError(INTERCEPT, xArray, yArray, expectedError);
 }
Пример #11
0
 private static void ConfirmValueError(String msg, String numerator, String denominator, ErrorEval numError)
 {
     ValueEval result = invokeValue(numerator, denominator);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(numError, result, msg);
 }
Пример #12
0
 private static void Confirm(IFormulaEvaluator fe, ICell cell, String formula,
         ErrorEval expectedResult)
 {
     fe.ClearAllCachedResultValues();
     cell.CellFormula=(formula);
     CellValue cv = fe.Evaluate(cell);
     if (cv.CellType != CellType.Error)
     {
         throw new AssertionException("expected error cell type but got " + cv.FormatAsString());
     }
     int expCode = expectedResult.ErrorCode;
     if (cv.ErrorValue != expCode)
     {
         throw new AssertionException("Expected error '" + ErrorEval.GetText(expCode)
                 + "' but got '" + cv.FormatAsString() + "'.");
     }
 }
Пример #13
0
 private void ConfirmError(ValueEval xArray, ValueEval yArray, ErrorEval expectedError)
 {
     ConfirmError(SLOPE, xArray, yArray, expectedError);
 }
Пример #14
0
 private static void ConfirmPredicate(bool expectedResult, I_MatchPredicate matchPredicate, ErrorEval value)
 {
     Assert.AreEqual(expectedResult, matchPredicate.Matches(value));
 }
Пример #15
0
 private static void ConfirmValueError(String msg, String number1, String number2, ErrorEval numError)
 {
     ValueEval result = invokeValue(number1, number2);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(numError, result, msg);
 }
Пример #16
0
 private static String formatErrorMessage(ErrorEval ee)
 {
     if (errorCodesAreEqual(ee, ErrorEval.VALUE_INVALID))
     {
         return "Error code: #VALUE! (invalid value)";
     }
     return "Error code=" + ee.ErrorCode;
 }
Пример #17
0
 private void ConfirmLen(ValueEval text, ErrorEval expectedError)
 {
     ValueEval result = invokeLen(text);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual(expectedError.ErrorCode, ((ErrorEval)result).ErrorCode);
 }
Пример #18
0
 private static void ConfirmValueError(String msg, String real_num, String i_num, String suffix, ErrorEval numError)
 {
     ValueEval result = invokeValue(real_num, i_num, suffix);
     Assert.AreEqual(typeof(ErrorEval), result.GetType());
     Assert.AreEqual( numError, result, msg);
 }