Beispiel #1
0
 public void Ubjl_Int64()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x4C, 0x12, 0x34, 0x56, 0x78, 0xAA, 0xBB, 0xCC, 0xDD });
     var o = ubjl.Read();
     Assert.AreEqual(0x12345678AABBCCDDL, (long)o);
 }
Beispiel #2
0
 public void Ubjl_Int16()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x49, 0xFF, 0xF8 });
     var o = ubjl.Read();
     Assert.AreEqual((short)-8, (short)o);
 }
Beispiel #3
0
 public void Ubjl_Int32()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x6C, 0x12, 0x34, 0x56, 0x78 });
     var o = ubjl.Read();
     Assert.AreEqual(0x12345678, (int)o);
 }
Beispiel #4
0
 public void Ubjl_Int8()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x69, 0xFF });
     var o = ubjl.Read();
     Assert.AreEqual((sbyte)-1, (sbyte)o);
 }
Beispiel #5
0
 public void Ubjl_UInt8()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x55, 0xFF });
     var o = ubjl.Read();
     Assert.AreEqual((byte)255, (byte)o);
 }
Beispiel #6
0
 public void Ubjl_True()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x4E, 0x54 });
     Assert.IsTrue((bool)ubjl.Read());
 }
Beispiel #7
0
 public void Ubjl_False()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x4E, 0x46, 0x4E, 0x5A });
     Assert.IsFalse((bool)ubjl.Read());
 }
Beispiel #8
0
 public void Ubjl_Noops()
 {
     var ubjl = new UbjsonReader(new byte[] { 0x4E, 0x4E, 0x4E, 0x5A });
     Assert.IsNull(ubjl.Read());
 }
Beispiel #9
0
 public void Ubjl_Float64()
 {
     var ubjl = new UbjsonReader(B(new byte[] { 0x44 }, B(-1.5)));
     var o = ubjl.Read();
     Assert.AreEqual(-1.5, (double)o);
 }
Beispiel #10
0
 public void Ubjl_Float32()
 {
     var ubjl = new UbjsonReader(B(new byte[] { 0x64 }, B(-1.5F)));
     var o = ubjl.Read();
     Assert.AreEqual(-1.5F, (float)o);
 }