Why do MSTests Assert.AreEqual(1.0, double.NaN, 0.0) pass?
Posted
by Egil Hansen
on Stack Overflow
See other posts from Stack Overflow
or by Egil Hansen
Published on 2009-11-22T21:07:02Z
Indexed on
2010/05/13
17:24 UTC
Read the original article
Hit count: 236
Short question, why do Assert.AreEqual(1.0, double.NaN, 0.0) pass when Assert.AreEqual(1.0, double.NaN) do not?
Is it an error in MSTest or am I missing something here?
Best regards, Egil.
Update: Should probably add, that the reason behind my question is, that I have a bunch of unit tests that unfortunately passed due to the result of some linear algebraic matrix operation being NaN or (+/-)Infinity. The unit tests are fine, but since Assert.AreEqual on doubles with a delta will pass when actual or/and expected are NaN or Infinity, I was left to believe that the code I was testing was correct.
© Stack Overflow or respective owner