diff --git a/tests/test/minmax.inc b/tests/test/minmax.inc index 4bc28756b6..3746312122 100644 --- a/tests/test/minmax.inc +++ b/tests/test/minmax.inc @@ -1,4 +1,3 @@ -{$mode objfpc} uses Math; @@ -642,10 +641,70 @@ procedure TestLongint; TestFail(338); end; + var + v1,v3 : Longint; + + function Min1: Longint; inline; + begin + if v1 < v3 then + Result := v1 + else + Result := v3; + end; + + + function Max1: Longint; inline; + begin + if v1 > v3 then + Result := v1 + else + Result := v3; + end; + +var + c1 : Longint = 1; + c3 : Longint = 3; + + function Min11: Longint; inline; + begin + if c1 < c3 then + Result := c1 + else + Result := c3; + end; + + + function Max11: Longint; inline; + begin + if c1 > c3 then + Result := c1 + else + Result := c3; + end; + + +procedure TestLongintGlobal; + + begin + v1:=1; + v3:=3; + if Min1<>1 then + TestFail(1301); + if Max1<>3 then + TestFail(1302); + + if Min11<>1 then + TestFail(1311); + if Max11<>3 then + TestFail(1312); + end; + + begin TestSingle; TestDouble; TestDWord; TestLongint; + TestLongintGlobal; WriteLn('ok'); end. diff --git a/tests/test/tminmax1.pp b/tests/test/tminmax1.pp index 18ccbbb70a..4ffa022452 100644 --- a/tests/test/tminmax1.pp +++ b/tests/test/tminmax1.pp @@ -1,2 +1,4 @@ { %opt=-O- -O1 } { ensure we test code generation without constant propagation } +{$mode objfpc} + {$I minmax.inc } \ No newline at end of file diff --git a/tests/test/tminmax2.pp b/tests/test/tminmax2.pp index 6e4e131d80..e658890092 100644 --- a/tests/test/tminmax2.pp +++ b/tests/test/tminmax2.pp @@ -1,3 +1,5 @@ { %opt=-Oonofastmath -O3 } { with fast math, the operands of min/max might be swapped and this breaks the tests using NaN, but test constant propagation and thus simplification } +{$mode objfpc} + {$I minmax.inc } \ No newline at end of file