コード例 #1
0
        public static void StructWithNestedDoubleFieldNotTightlyPackedZeroCompareTest()
        {
            StructWithDoubleFieldNestedNotTightlyPacked obj1 = new StructWithDoubleFieldNestedNotTightlyPacked();
            obj1.value1.value1 = 1;
            obj1.value2.value2 = 0.0;

            StructWithDoubleFieldNestedNotTightlyPacked obj2 = new StructWithDoubleFieldNestedNotTightlyPacked();
            obj2.value1.value1 = 1;
            obj2.value2.value2 = -0.0;

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

            obj1.value1.value1 = 1;
            obj1.value2.value2 = double.NaN;

            StructWithDoubleFieldNestedNotTightlyPacked obj2 = new StructWithDoubleFieldNestedNotTightlyPacked();

            obj2.value1.value1 = 1;
            obj2.value2.value2 = -double.NaN;

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