/// <inheritdoc/> public readonly override int GetHashCode() { if (!IsInitialized) { return(0); } return(WorldMatrix.GetHashCode() ^ VirtualSize.GetHashCode() ^ KeepAspectRatio.GetHashCode()); }
public void Matrix3x2GetHashCodeTest() { Matrix3x2 target = GenerateIncrementalMatrixNumber(); int expected = unchecked (target.M11.GetHashCode() + target.M12.GetHashCode() + target.M21.GetHashCode() + target.M22.GetHashCode() + target.M31.GetHashCode() + target.M32.GetHashCode()); int actual; actual = target.GetHashCode(); Assert.Equal(expected, actual); }
public void Matrix3x2GetHashCodeTest() { Matrix3x2 target = GenerateIncrementalMatrixNumber(); int expected = HashCode.Combine(target.M11, target.M12, target.M21, target.M22, target.M31, target.M32); int actual; actual = target.GetHashCode(); Assert.Equal(expected, actual); }
public void Matrix3x2GetHashCodeTest() { Matrix3x2 target = GenerateMatrixNumberFrom1To6(); int expected = target.M11.GetHashCode() + target.M12.GetHashCode() + target.M21.GetHashCode() + target.M22.GetHashCode() + target.M31.GetHashCode() + target.M32.GetHashCode(); int actual; actual = target.GetHashCode(); Assert.Equal(expected, actual); }
public void Matrix3x2GetHashCodeTest() { Matrix3x2 target = GenerateMatrixNumberFrom1To6(); int expected = target.M11.GetHashCode() + target.M12.GetHashCode() + target.M21.GetHashCode() + target.M22.GetHashCode() + target.M31.GetHashCode() + target.M32.GetHashCode(); int actual; actual = target.GetHashCode(); Assert.AreEqual(expected, actual, "Matrix3x2.GetHashCode did not return the expected value."); }
public void HashCodeGenerationWorksCorrectly() { HashSet <int> hashCodes = new HashSet <int>(); Matrix3x2 value = new Matrix3x2(1); for (int i = 2; i <= 100; i++) { Assert.True(hashCodes.Add(value.GetHashCode()), "Unique hash code generation failure."); value *= i; } }
public void HashCodeGenerationWorksCorrectly() { HashSet<int> hashCodes = new HashSet<int>(); Matrix3x2 value = new Matrix3x2(1); for (int i = 2; i <= 100; i++) { if (!hashCodes.Add(value.GetHashCode())) { Assert.Fail("Unique hash code generation failure."); } value *= i; } }