当前位置: 首页>>代码示例>>C#>>正文


C# Matrix.GetHashCode方法代码示例

本文整理汇总了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());
 }
开发者ID:hillwhite,项目名称:DeltaEngine,代码行数:9,代码来源:MatrixTests.cs

示例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"));
        }
开发者ID:ajlopez,项目名称:MathelSharp,代码行数:24,代码来源:MatrixTests.cs

示例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));
        }
开发者ID:roberino,项目名称:linqinfer,代码行数:19,代码来源:MatrixTests.cs

示例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 ();
			}
		}
开发者ID:SvDvorak,项目名称:Mono.GameMath,代码行数:14,代码来源:MatrixTest.cs

示例5: op_GetHashCode_whenEmpty

        public void op_GetHashCode_whenEmpty()
        {
            var expected = string.Empty.GetHashCode();

            var actual = new Matrix<decimal>();

            Assert.Equal(expected, actual.GetHashCode());
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:8,代码来源:Matrix`1.Facts.cs

示例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());
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:9,代码来源:Matrix`1.Facts.cs

示例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());
 }
开发者ID:WilliamRobertMontgomery,项目名称:asp-dot-net-training-project,代码行数:7,代码来源:MatrixTest.cs

示例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("Проверьте правильность этого метода теста.");
 }
开发者ID:vanderkorn,项目名称:math,代码行数:10,代码来源:MatrixTest.cs

示例9: GetHashCode_for_empty_matrix

        public void GetHashCode_for_empty_matrix()
        {
            var matrix = new Matrix();

            var hash = matrix.GetHashCode();

            Assert.AreEqual(0, hash);
        }
开发者ID:Christof,项目名称:afterglow,代码行数:8,代码来源:Test_Matrix.cs


注:本文中的System.Matrix.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。