本文整理汇总了C#中System.Matrix.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# Matrix.GetHashCode方法的具体用法?C# Matrix.GetHashCode怎么用?C# Matrix.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Matrix
的用法示例。
在下文中一共展示了Matrix.GetHashCode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateHashCode
public void CalculateHashCode()
{
var matrix1 = new Matrix(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
int hashCode = 0.0f.GetHashCode() + 1.0f.GetHashCode() + 2.0f.GetHashCode() + 3.0f.GetHashCode() +
4.0f.GetHashCode() + 5.0f.GetHashCode() + 6.0f.GetHashCode() + 7.0f.GetHashCode() +
8.0f.GetHashCode() + 9.0f.GetHashCode() + 10.0f.GetHashCode() + 11.0f.GetHashCode() +
12.0f.GetHashCode() + 13.0f.GetHashCode() + 14.0f.GetHashCode() + 15.0f.GetHashCode();
Assert.AreEqual(hashCode, matrix1.GetHashCode());
}
示例2: EqualsAndHashCode
public void EqualsAndHashCode()
{
Matrix matrix1 = new Matrix(new double[][] { new double[] { 1.0, 2.0 }, new double[] { 3.0, 4.0 } });
Matrix matrix2 = new Matrix(new double[][] { new double[] { 1.0, 2.0 }, new double[] { 3.0, 4.0 } });
Matrix matrix3 = new Matrix(new double[][] { new double[] { 1.0, 2.0 }, new double[] { 3.0, 5.0 } });
Matrix matrix4 = new Matrix(new double[][] { new double[] { 1.0, 2.0, 3.0 }, new double[] { 3.0, 4.0, 5.0 } });
Matrix matrix5 = new Matrix(new double[][] { new double[] { 1.0, 2.0 }, new double[] { 3.0, 4.0 }, new double[] { 5.0, 6.0 } });
Assert.IsTrue(matrix1.Equals(matrix2));
Assert.IsTrue(matrix2.Equals(matrix1));
Assert.AreEqual(matrix2.GetHashCode(), matrix1.GetHashCode());
Assert.IsFalse(matrix1.Equals(matrix3));
Assert.IsFalse(matrix1.Equals(matrix4));
Assert.IsFalse(matrix1.Equals(matrix5));
Assert.IsFalse(matrix3.Equals(matrix1));
Assert.IsFalse(matrix4.Equals(matrix1));
Assert.IsFalse(matrix5.Equals(matrix1));
Assert.IsFalse(matrix1.Equals(null));
Assert.IsFalse(matrix1.Equals(42));
Assert.IsFalse(matrix1.Equals("foo"));
}
示例3: GetHashCode_ReturnsSameValueForEquivMatrixes
public void GetHashCode_ReturnsSameValueForEquivMatrixes()
{
var m1 = new Matrix(new[]
{
new [] { 3d, 5d },
new [] { 6d, 8.7d },
});
var m2 = new Matrix(new[]
{
new [] { 3d, 5d },
new [] { 6d, 8.7d },
});
var hash1 = m1.GetHashCode();
var hash2 = m1.GetHashCode();
Assert.That(hash1, Is.EqualTo(hash2));
}
示例4: HashCode
public static void HashCode (int times)
{
var value = new Matrix (
0f, 0f, 0f, 0f,
0f, 0f, 0f, 0f,
0f, 0f, 0f, 0f,
0f, 0f, 0f, 1f
);
int result;
for (int i = 0; i < times; i++) {
result = value.GetHashCode ();
}
}
示例5: op_GetHashCode_whenEmpty
public void op_GetHashCode_whenEmpty()
{
var expected = string.Empty.GetHashCode();
var actual = new Matrix<decimal>();
Assert.Equal(expected, actual.GetHashCode());
}
示例6: op_GetHashCode
public void op_GetHashCode()
{
var expected = "-1\r\n".GetHashCode();
var actual = new Matrix<decimal>(1, 1);
actual[0, 0] = decimal.MinusOne;
Assert.Equal(expected, actual.GetHashCode());
}
示例7: GetHashCode_Not_Equal_Matrixes_Test
public void GetHashCode_Not_Equal_Matrixes_Test()
{
Matrix a = new Matrix(2, 2, 1);
Matrix b = new Matrix(2, 2, 2);
Assert.AreNotEqual(a, b);
Assert.AreNotEqual(a.GetHashCode(), b.GetHashCode());
}
示例8: GetHashCodeTest
public void GetHashCodeTest()
{
double[,] data = null; // TODO: инициализация подходящего значения
Matrix target = new Matrix(data); // TODO: инициализация подходящего значения
int expected = 0; // TODO: инициализация подходящего значения
int actual;
actual = target.GetHashCode();
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Проверьте правильность этого метода теста.");
}
示例9: GetHashCode_for_empty_matrix
public void GetHashCode_for_empty_matrix()
{
var matrix = new Matrix();
var hash = matrix.GetHashCode();
Assert.AreEqual(0, hash);
}