Ejemplo n.º 1
0
        public void BitwiseMethods()
        {
            long     MaxValue   = SqlInt64.MaxValue.Value;
            SqlInt64 TestInt    = new SqlInt64(0);
            SqlInt64 TestIntMax = new SqlInt64(MaxValue);
            SqlInt64 TestInt2   = new SqlInt64(10922);
            SqlInt64 TestInt3   = new SqlInt64(21845);

            // BitwiseAnd
            Assert.AreEqual((long)21845, SqlInt64.BitwiseAnd(TestInt3, TestIntMax).Value, "#E01");
            Assert.AreEqual((long)0, SqlInt64.BitwiseAnd(TestInt2, TestInt3).Value, "#E02");
            Assert.AreEqual((long)10922, SqlInt64.BitwiseAnd(TestInt2, TestIntMax).Value, "#E03");

            //BitwiseOr
            Assert.AreEqual((long)21845, SqlInt64.BitwiseOr(TestInt, TestInt3).Value, "#E04");
            Assert.AreEqual((long)MaxValue, SqlInt64.BitwiseOr(TestIntMax, TestInt2).Value, "#E05");
        }
Ejemplo n.º 2
0
        public void BitwiseMethods()
        {
            long     MaxValue   = SqlInt64.MaxValue.Value;
            SqlInt64 testInt    = new SqlInt64(0);
            SqlInt64 testIntMax = new SqlInt64(MaxValue);
            SqlInt64 testInt2   = new SqlInt64(10922);
            SqlInt64 testInt3   = new SqlInt64(21845);

            // BitwiseAnd
            Assert.Equal(21845, SqlInt64.BitwiseAnd(testInt3, testIntMax).Value);
            Assert.Equal(0, SqlInt64.BitwiseAnd(testInt2, testInt3).Value);
            Assert.Equal(10922, SqlInt64.BitwiseAnd(testInt2, testIntMax).Value);

            //BitwiseOr
            Assert.Equal(21845, SqlInt64.BitwiseOr(testInt, testInt3).Value);
            Assert.Equal(MaxValue, SqlInt64.BitwiseOr(testIntMax, testInt2).Value);
        }