|
|
@ -21,9 +21,9 @@ |
|
|
|
program coerce; |
|
|
|
|
|
|
|
var |
|
|
|
failed: boolean; |
|
|
|
failed: Boolean; |
|
|
|
|
|
|
|
procedure run(msg: string; value: boolean); |
|
|
|
procedure run(msg: String; value: Boolean); |
|
|
|
begin |
|
|
|
Write(msg); |
|
|
|
Write(" ... "); |
|
|
@ -36,12 +36,26 @@ begin |
|
|
|
end; |
|
|
|
|
|
|
|
procedure run_tests; |
|
|
|
var |
|
|
|
b: Byte; |
|
|
|
s: ShortInt; |
|
|
|
begin |
|
|
|
b := 3; |
|
|
|
s := 67; |
|
|
|
run("coerce_byte_short", SameType(Integer, b / s)); |
|
|
|
run("coerce_int_byte", SameType(Integer, 3 + b)); |
|
|
|
run("coerce_byte_uint", SameType(Cardinal, b * 080000000H)); |
|
|
|
run("coerce_int_short", SameType(Integer, 3 + s)); |
|
|
|
run("coerce_short_uint", SameType(Integer, s * 080000000H)); |
|
|
|
run("coerce_int_int", SameType(Integer, 3 + 4)); |
|
|
|
run("coerce_int_uint", SameType(Integer, 3 + 0FFFFFFFFH)); |
|
|
|
run("coerce_int_uint", SameType(Integer, 3 - 0FFFFFFFFH)); |
|
|
|
run("coerce_uint_int", SameType(Integer, 0FFFFFFFFH mod 3)); |
|
|
|
run("coerce_uint_uint", SameType(Cardinal, 080000000H + 0FFFFFFFFH)); |
|
|
|
run("coerce_int_long", SameType(LongInt, 3 / 07FFFFFFFFFFFH)); |
|
|
|
run("coerce_long_int", SameType(LongInt, 07FFFFFFFFFFFH * 3)); |
|
|
|
run("coerce_long_uint", SameType(LongInt, 07FFFFFFFFFFFH * 0FFFFFFFFH)); |
|
|
|
run("coerce_uint_ulong", |
|
|
|
SameType(LongCard, 0FFFFFFFFH + 08000000000000000H)); |
|
|
|
end; |
|
|
|
|
|
|
|
begin |
|
|
|