コード例 #1
0
        public void DynamicSByte()
        {
            var   rnd       = new CryptoRandom();
            int   itemCount = byte.MaxValue;
            sbyte value     = 0;

            sbyte[] values = new sbyte[itemCount];
            BVector d      = new BVector();

            for (uint i = 0; i < itemCount; i++)
            {
                value = (sbyte)rnd.NextLong(sbyte.MinValue, sbyte.MaxValue);
                d.DynamicAdd(value);
                d.Add1();
                values[i] = value;
            }
            d.DynamicAdd(sbyte.MinValue);
            d.Add1();
            d.DynamicAdd(sbyte.MaxValue);
            d.Add1();
            d.DynamicAdd((sbyte)0);

            for (uint i = 0; i < itemCount; i++)
            {
                Assert.AreEqual(values[i], d.DynamicGetSByte());
                Assert.AreEqual(true, d.Get1());
            }
            Assert.AreEqual(sbyte.MinValue, d.DynamicGetSByte());
            Assert.AreEqual(true, d.Get1());
            Assert.AreEqual(sbyte.MaxValue, d.DynamicGetSByte());
            Assert.AreEqual(true, d.Get1());
            Assert.AreEqual((sbyte)0, d.DynamicGetSByte());
        }