示例#1
0
        public static List <LargeInteger> ReadLinearCoder(LinearEncoder coder)
        {
            var data = coder.ReadData(0);

            var ret = new List <LargeInteger>();

            foreach (var byteArray in data)
            {
                ret.Add(new LargeInteger(byteArray));
            }

            return(ret);
        }
示例#2
0
        public void LinearOffsetCoderUnitTest()
        {
            string path = "linearCoderTest";

            if (File.Exists(path))
            {
                File.Delete(path);
            }

            var linearCoder = new LinearEncoder(path, 64);

            var expected = new byte[15][];

            for (int i = 0; i < expected.Length; i++)
            {
                expected[i] = new byte[64];

                for (int j = 0; j < 64; j++)
                {
                    expected[i][j] = (byte)(33 + j + i); //test data
                }
            }

            linearCoder.Append(expected);

            var actual = linearCoder.ReadData();

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.IsTrue(ArrayManipulator.Compare(expected[i], actual[i]));
            }

            Assert.AreEqual(expected.Length, linearCoder.Count);

            linearCoder.Remove(1);

            Assert.AreEqual((byte)35, linearCoder.ReadData()[1][0]);
        }