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)); }
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()); }