コード例 #1
0
        public static void StructWithNestedFloatFieldTightlyPackedNaNCompareTest()
        {
            StructWithFloatFieldNestedTightlyPacked obj1 = new StructWithFloatFieldNestedTightlyPacked();
            obj1.value1.value1 = float.NaN;
            obj1.value2.value2 = 1;

            StructWithFloatFieldNestedTightlyPacked obj2 = new StructWithFloatFieldNestedTightlyPacked();
            obj2.value1.value1 = -float.NaN;
            obj2.value2.value2 = 1;

            Assert.True(obj1.Equals(obj2));
        }
コード例 #2
0
ファイル: ValueTypeTests.cs プロジェクト: rsumner31/corefx2
        public static void StructWithNestedFloatFieldTightlyPackedZeroCompareTest()
        {
            StructWithFloatFieldNestedTightlyPacked obj1 = new StructWithFloatFieldNestedTightlyPacked();

            obj1.value1.value1 = 0.0f;
            obj1.value2.value2 = 1;

            StructWithFloatFieldNestedTightlyPacked obj2 = new StructWithFloatFieldNestedTightlyPacked();

            obj2.value1.value1 = -0.0f;
            obj2.value2.value2 = 1;

            Assert.True(obj1.Equals(obj2));
            Assert.Equal(obj1.GetHashCode(), obj2.GetHashCode());
        }