Ver Fonte

+ add a test that check for correct functionality of all the SwapEndian() overloads

Sven/Sarah Barth há 1 ano atrás
pai
commit
98fc58b229
1 ficheiros alterados com 31 adições e 0 exclusões
  1. 31 0
      tests/test/tendian2.pp

+ 31 - 0
tests/test/tendian2.pp

@@ -0,0 +1,31 @@
+program tendian;
+
+var
+  i16: Int16;
+  i32: Int32;
+  i64: Int64;
+  u16: UInt16;
+  u32: UInt32;
+  u64: UInt64;
+begin
+  i16 := $1234;
+  i32 := $12345678;
+  i64 := $1234567843218765;
+  u16 := $1234;
+  u32 := $12345678;
+  u64 := $1234567843218765;
+
+  if SwapEndian(i16) <> $3412 then
+    Halt(1);
+  if SwapEndian(i32) <> $78563412 then
+    Halt(2);
+  if SwapEndian(i64) <> $6587214378563412 then
+    Halt(3);
+
+  if SwapEndian(u16) <> $3412 then
+    Halt(4);
+  if SwapEndian(u32) <> $78563412 then
+    Halt(5);
+  if SwapEndian(u64) <> $6587214378563412 then
+    Halt(6);
+end.