Fixed a rounding bug in the Matrix GetHashCode that would cause matrices that were deemed equal to not have the same hash code

This commit is contained in:
Jeff Moser
2010-04-25 21:50:46 -04:00
parent 592a82b423
commit 9bc97fa1c3
6 changed files with 20 additions and 6 deletions

View File

@ -121,6 +121,16 @@ namespace UnitTests.Numerics
Assert.AreEqual(d, f);
Assert.AreEqual(d.GetHashCode(), f.GetHashCode());
// Test rounding (thanks to nsp on GitHub for finding this case)
var g = new SquareMatrix(1, 2.00000000000001,
3, 4);
var h = new SquareMatrix(1, 2,
3, 4);
Assert.IsTrue(g == h);
Assert.AreEqual(g, h);
Assert.AreEqual(g.GetHashCode(), h.GetHashCode());
}
[Test]