Exemplo n.º 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));
        }
Exemplo n.º 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);
            }
        }
Exemplo n.º 3
0
 static Schema()
 {
     ByteSequence = new ByteSequenceSchema();
     ByteArray    = new ByteArraySchema();
     String       = StringSchema.UTF8;
     Boolean      = new BooleanSchema();
     Int8         = new ByteSchema();
     Int16        = new ShortSchema();
     Int32        = new IntegerSchema();
     Int64        = new LongSchema();
     Float        = new FloatSchema();
     TimeStamp    = TimestampSchema.Timestamp;
     Date         = TimestampSchema.Date;
     Time         = new TimeSchema();
 }