提交 5e0e499c 编写于 作者: J Jason Malinowski

Throw the same exception in DEBUG and non-DEBUG tests

AssertFailureException is something I want to make internal to the
TraceListener, so let's just simplify this code.
上级 9c43dbb3
......@@ -403,17 +403,10 @@ static void CheckOneDouble(string s, double expected)
if (!RealParser.TryParseDouble(s, out actual)) actual = 1.0 / 0.0;
if (!actual.Equals(expected))
{
#if DEBUG
throw new AssertFailureException($@"
Error for double input ""{s}""
expected {InvariantToString(expected)}
actual {InvariantToString(actual)}");
#else
throw new Exception($@"
Error for double input ""{s}""
expected {InvariantToString(expected)}
actual {InvariantToString(actual)}");
#endif
}
}
......@@ -585,15 +578,9 @@ static void CheckOneFloat(string s, float expected)
if (!RealParser.TryParseFloat(s, out actual)) actual = 1.0f / 0.0f;
if (!actual.Equals(expected))
{
#if DEBUG
throw new AssertFailureException($@"Error for float input ""{s}""
expected {InvariantToString(expected)}
actual {InvariantToString(actual)}");
#else
throw new Exception($@"Error for float input ""{s}""
expected {InvariantToString(expected)}
actual {InvariantToString(actual)}");
#endif
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册