瀏覽代碼

+ add a test for converting a 64-bit Boolean (either QWordBool or Boolean64) to a 32-bit signed integer (this problematic case was discovered after e65b822a on PowerPC

Sven Barth 3 年之前
父節點
當前提交
69bfff046a
共有 1 個文件被更改,包括 35 次插入0 次删除
  1. 35 0
      tests/tbs/tb0688.pp

+ 35 - 0
tests/tbs/tb0688.pp

@@ -0,0 +1,35 @@
+program tb0688;
+
+function Test(var aArg: QWordBool): LongInt;
+begin
+  Test := LongInt(aArg);
+end;
+
+function Test(var aArg: Boolean64): LongInt;
+begin
+  Test := LongInt(aArg);
+end;
+
+var
+  b64: Boolean64;
+  qb: QWordBool;
+begin
+  b64 := True;
+  if Test(b64) <> 1 then
+    Halt(1);
+  b64 := False;
+  if Test(b64) <> 0 then
+    Halt(2);
+  qb := True;
+  if Test(qb) <> -1 then
+    Halt(3);
+  qb := False;
+  if Test(qb) <> 0 then
+    Halt(4);
+  qb := QWordBool($12341234);
+  if Test(qb) <> $12341234 then
+    Halt(5);
+  qb := QWordBool($100000000);
+  if Test(qb) <> 0 then
+    Halt(6);
+end.