...there is nonetheless. Watch out for this! You won't have this problem if you divide a double or a decimal by an int, but int by int division is crazy. The following test passes even though forty-two divided by thirteen really should give an irrational number closer to pi than three.
[TestMethod]
public void BadTest()
{
int fortyTwo = 42;
int thirteen = 13;
Assert.AreEqual(fortyTwo/thirteen,3);
}
No comments:
Post a Comment