Esempio n. 1
0
        public void EncodeVectorTest2()
        {
            var vector1 = new byte[] { 1, 1, 0 };
            var vector2 = new byte[] { 0, 1, 0 };
            var vector3 = new byte[] { 0, 0, 1 };
            var vector4 = new byte[] { 1, 1, 1 };
            var vector5 = new byte[] { 1, 0, 1 };
            var vector6 = new byte[] { 0, 1, 0 };
            var matrix  = new byte[3, 4]
            {
                { 1, 1, 0, 0 },
                { 0, 1, 1, 1 },
                { 1, 0, 1, 0 }
            };
            EncodeManager manager = new EncodeManager();
            var           result1 = manager.EncodeVector(vector1, matrix);
            var           result2 = manager.EncodeVector(vector2, matrix);
            var           result3 = manager.EncodeVector(vector3, matrix);
            var           result4 = manager.EncodeVector(vector4, matrix);
            var           result5 = manager.EncodeVector(vector5, matrix);
            var           result6 = manager.EncodeVector(vector6, matrix);

            Assert.IsTrue(result1.OfType <byte>().SequenceEqual(new byte[] { 1, 0, 1, 1 }.OfType <byte>()));
            Assert.IsTrue(result2.OfType <byte>().SequenceEqual(new byte[] { 0, 1, 1, 1 }.OfType <byte>()));
            Assert.IsTrue(result3.OfType <byte>().SequenceEqual(new byte[] { 1, 0, 1, 0 }.OfType <byte>()));
            Assert.IsTrue(result4.OfType <byte>().SequenceEqual(new byte[] { 0, 0, 0, 1 }.OfType <byte>()));
            Assert.IsTrue(result5.OfType <byte>().SequenceEqual(new byte[] { 0, 1, 1, 0 }.OfType <byte>()));
            Assert.IsTrue(result6.OfType <byte>().SequenceEqual(new byte[] { 0, 1, 1, 1 }.OfType <byte>()));
        }
Esempio n. 2
0
        public void EncodeVectorTest()
        {
            var vector = new byte[] { 1, 0, 1, 0 };
            var matrix = new byte[4, 7]
            {
                { 1, 0, 0, 0, 1, 1, 0 },
                { 0, 1, 0, 0, 0, 1, 0 },
                { 0, 0, 1, 0, 0, 1, 1 },
                { 0, 0, 0, 1, 1, 0, 0 }
            };
            EncodeManager manager = new EncodeManager();
            var           result  = manager.EncodeVector(vector, matrix);

            Assert.IsTrue(result.OfType <byte>().SequenceEqual(new byte[] { 1, 0, 1, 0, 1, 0, 1 }.OfType <byte>()));
        }