예제 #1
0
        public void Should_SerializeInt3()
        {
            Int3 value = Int3.MaxValue; // range -3 to 3

            Assert.AreEqual(false, value._sign);
            Assert.AreEqual(1, value.GetBit(0));
            Assert.AreEqual(1, value.GetBit(1));
            Assert.AreEqual(new Bit[] { 1, 1, 0 }, value.GetBits());

            value = Int3.MinValue;
            Assert.AreEqual(true, value._sign);
            Assert.AreEqual(1, value.GetBit(0));
            Assert.AreEqual(1, value.GetBit(1));
            Assert.AreEqual(new Bit[] { 1, 1, 1 }, value.GetBits());

            // test overflow
            value = (Int3)5;
            Assert.AreEqual(1, value);
            Assert.AreEqual(false, value._sign);
            Assert.AreEqual(1, value.GetBit(0));
            Assert.AreEqual(0, value.GetBit(1));
            Assert.AreEqual(new Bit[] { 1, 0, 0 }, value.GetBits());
        }