Beispiel #1
0
        public virtual void TestSchemaDecode()
        {
            var   byteData = new byte[] { 24, 42 };
            short?expected = 24 * 256 + 42;
            var   schema   = ShortSchema.Of();

            Assert.Equal(expected, schema.Decode(byteData));
        }
Beispiel #2
0
        public virtual void TestSchemaEncodeDecodeFidelity()
        {
            var   schema = ShortSchema.Of();
            short start  = 3440;

            for (short i = 0; i < 100; ++i)
            {
                var encode  = schema.Encode((short)(start + i));
                int decoded = schema.Decode(encode);
                Assert.Equal(decoded, start + i);
            }
        }