コード例 #1
0
        public virtual void TestSchemaDecode()
        {
            var byteData = new byte[] { 0, 10, 24, 42 };
            int?expected = 10 * 65536 + 24 * 256 + 42;
            var schema   = IntSchema.Of();

            Assert.Equal(expected, schema.Decode(byteData));
        }
コード例 #2
0
        public virtual void TestSchemaEncodeDecodeFidelity()
        {
            var schema = IntSchema.Of();
            var start  = 348592040;

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