Пример #1
0
        public static void BitwiseEqualityForPrimitive()
        {
            var value1 = 10L;
            var value2 = 20L;

            False(BitwiseComparer <long> .Equals(value1, value2));
            value2 = 10L;
            True(BitwiseComparer <long> .Equals(value1, value2));
        }
Пример #2
0
        public static void BitwiseEqualityForDifferentTypesOfTheSameSize()
        {
            var value1 = 1U;
            var value2 = 0;

            False(BitwiseComparer <uint> .Equals(value1, value2));
            value2 = 1;
            True(BitwiseComparer <uint> .Equals(value1, value2));
        }
Пример #3
0
        public static void BitwiseEqualityCheck()
        {
            var value1 = Guid.NewGuid();
            var value2 = value1;

            True(BitwiseComparer <Guid> .Equals(value1, value2));
            value2 = default;
            False(BitwiseComparer <Guid> .Equals(value1, value2));
        }
Пример #4
0
        public static void BitwiseEqualityCheckBigStruct()
        {
            var value1 = (new Point {
                X = 10, Y = 20
            }, new Point {
                X = 15, Y = 20
            });
            var value2 = (new Point {
                X = 10, Y = 20
            }, new Point {
                X = 15, Y = 30
            });

            False(BitwiseComparer <Point> .Equals(value1, value2));
            value2.Item2.Y = 20;
            True(BitwiseComparer <Point> .Equals(value1, value2));
        }