Dump (DataConverter.Pack ("z8", "hello"), "68 65 6c 6c 6f 00 00 00 00");
Dump (DataConverter.Pack ("z6", "hello"), "68 00 65 00 6c 00 6c 00 6f 00 00 00 00 00");
Dump (DataConverter.Pack ("CCCC", 65, 66, 67, 68), "41 42 43 44");
-
+
Dump (DataConverter.Pack ("4C", 65, 66, 67, 68, 69, 70), "41 42 43 44");
Dump (DataConverter.Pack ("^iii", 0x1234abcd, 0x7fadb007), " 12 34 ab cd 7f ad b0 07 00 00 00 00");
Dump (DataConverter.Pack ("_s!i", 0x7b, 0x12345678), "7b 00 00 00 78 56 34 12");
+ byte [] b = DataConverter.Pack ("4C", 1, 2, 3, 4);
+ foreach (object c in DataConverter.Unpack ("4C", b, 0)){
+ Console.WriteLine ("->{0} {1}", c, c.GetType ());
+ }
Console.WriteLine ("Tests {0}", fail ? "failed" : "passed");
+
+ byte [] source = new byte [] { 1, 2, 3, 4 };
+ byte [] dest = new byte [4];
+
+ int l = DataConverter.Int32FromBE (source, 0);
+ if (l != 0x01020304){
+ Console.WriteLine ("Failure");
+ }
}
}