public void ImplicitOperator()
        {
            var  bits  = new BitFields(5);
            long value = bits;

            Assert.AreEqual(5, value);
        }
        public void StateSetGet()
        {
            var bits = new BitFields();

            bits.State = 5;
            Assert.AreEqual(5, bits.State);
        }
        public void IndexerSetGet()
        {
            var bits = new BitFields();

            bits[2] = true;
            Assert.AreEqual(4, bits.State);
            Assert.IsTrue(bits[2]);
        }
        public void IndexSet_UpperRangeException()
        {
            var bits = new BitFields();

            Assert.Throws <IndexOutOfRangeException>(() =>
            {
                bits[64] = true;
            });
        }
        public void IndexGet_UpperRangeException()
        {
            var bits = new BitFields();

            Assert.Throws <IndexOutOfRangeException>(() =>
            {
                var value = bits[64];
            });
        }
Esempio n. 6
0
                                public static @string String(this BitFields bs)
                                {
                                    var ss = make_slice <@string>(len(bs));

                                    foreach (var(i, bf) in bs)
                                    {
                                        ss[i] = bf.String();
                                    }
                                    return(fmt.Sprintf("<%s>", strings.Join(ss, "|")));
                                }
        public void ConstructorSingleArgument()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(3, bits.State);
        }
        public void RightShift_Operator()
        {
            var bits = new BitFields(1);

            Assert.AreEqual(1 >> 3, bits >> 3);
        }
        public void Xor_Instance()
        {
            BitFields bits = new BitFields(3);

            Assert.AreEqual(3 ^ 2, bits.Xor(2));
        }
        public void And_Operator()
        {
            BitFields bits = new BitFields(3);

            Assert.AreEqual(3 & 2, bits & 2);
        }
 public void Not_Static()
 {
     Assert.AreEqual(~3, BitFields.Not(3));
 }
 public void Xor_Static()
 {
     Assert.AreEqual(3 ^ 2, BitFields.Xor(3, 2));
 }
 public void Or_Static()
 {
     Assert.AreEqual(3 | 2, BitFields.Or(3, 2));
 }
 public void And_Static()
 {
     Assert.AreEqual(3 & 2, BitFields.And(3, 2));
 }
        public void Not_Instance()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(~3, bits.Not());
        }
        public void ConstructorDefault()
        {
            var bits = new BitFields();

            Assert.AreEqual(0, bits.State);
        }
        public void Count()
        {
            var bits = new BitFields();

            Assert.AreEqual(64, bits.Count);
        }
        public void Or_Operator()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(3 | 2, bits | 2);
        }
        public void Xor_Operator()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(3 ^ 2, bits ^ 2);
        }
        public void Not_Operator()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(~3, ~bits);
        }
        public void And_Instance()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(3 & 2, bits.And(2));
        }
        public void LeftShift_Operator()
        {
            var bits = new BitFields(1);

            Assert.AreEqual(1 << 3, bits << 3);
        }
Esempio n. 23
0
 public argField(ArgType Type = default, byte Shift = default, BitFields BitFields = default)
 {
     this.Type      = Type;
     this.Shift     = Shift;
     this.BitFields = BitFields;
 }
        public void Or_Instance()
        {
            var bits = new BitFields(3);

            Assert.AreEqual(3 | 2, bits.Or(2));
        }