示例#1
0
        public static void StructWithNestedFloatFieldNotTightlyPackedNaNCompareTest()
        {
            StructWithFloatFieldNestedNotTightlyPacked obj1 = new StructWithFloatFieldNestedNotTightlyPacked();
            obj1.value1.value1 = float.NaN;
            obj1.value2.value2 = 1;

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

            Assert.True(obj1.Equals(obj2));
        }
示例#2
0
        public static void StructWithNestedFloatFieldNotTightlyPackedZeroCompareTest()
        {
            StructWithFloatFieldNestedNotTightlyPacked obj1 = new StructWithFloatFieldNestedNotTightlyPacked();

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

            StructWithFloatFieldNestedNotTightlyPacked obj2 = new StructWithFloatFieldNestedNotTightlyPacked();

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

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