public void GetHashCodeTest() { var r = new Register32(10); Assert.Equal(r.GetHashCode(), new Register32(10).GetHashCode()); Assert.NotEqual(r.GetHashCode(), new Register32(20).GetHashCode()); }
public void EqualityTest(uint value) { var r1 = new Register32(value); var r2 = new Register32(value / 2 - 1); var r3 = new Register32(value); Assert.True(r1 == r3); Assert.True(r1 != r2); Assert.True(r2 != r3); Assert.True(r1.Equals(r3)); Assert.False(r1.Equals(r2)); Assert.False(r2.Equals(r3)); Assert.True(r1.Equals((object)r3)); Assert.False(r1.Equals((object)r2)); Assert.False(r2.Equals((object)r3)); Assert.Equal(r1.GetHashCode(), r3.GetHashCode()); }