Browse Source

- removed printing direct types, uses comparison instead

carl 24 years ago
parent
commit
2db77e26b6
1 changed files with 205 additions and 46 deletions
  1. 205 46
      tests/test/cg/tshlshr.pp

+ 205 - 46
tests/test/cg/tshlshr.pp

@@ -6,9 +6,11 @@
 { PRE-REQUISITES: secondload()                              }
 {                 secondassign()                            }
 {                 secondtypeconv()                          }
+{                 secondinline() with strings only!         }
+{                 secondadd() comparison                    }
+{                 secondifn()                               }
 {***********************************************************}
-{ DEFINES  :  VERBOSE if testing should be verbose          }
-{             FPC if target is FreePascal compiler          }
+{ DEFINES  :  FPC if target is Free Pascal compiler         }
 {***********************************************************}
 { REMARKS: None                                             }
 {***********************************************************}
@@ -39,131 +41,237 @@ var
 {$ENDIF}
 Begin
    WriteLn('------------------------------ LONGINT --------------------------------');
-
    { left : LOC_REFERENCE     }
    { right : numeric constant }
    WriteLn('(left) : LOC_REFERENCE; (right) : ordinal constant');
    longres:=1;
    longres := longres shl 15;
-   WriteLn('(SHL) Value should be 32768...',longres);
+   Write('(SHL) Value should be 32768...');
+   if longres = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
    longres:=-1;
    longres := longres shl 15;
-   WriteLn('(SHL) Value should be -32768...',longres);
+   Write('(SHL) Value should be -32768...');
+   if longres = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
    longres:=1;
    longres := longres shl 33;
-   WriteLn('(SHL) Value should be 2...',longres);
+   Write('(SHL) Value should be 2...');
+   if longres = 2 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres:=$8000;
    longres := longres shr 15;
-   WriteLn('(SHR) Value should be 1...',longres);
+   Write('(SHR) Value should be 1...');
+   if longres = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    longres:=-1;
    longres := longres shr 15;
-   WriteLn('(SHR) Value should be 131071...',longres);
+   Write('(SHR) Value should be 131071...');
+   if longres = 131071 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    longres:=$FFFF;
    longres := longres shr 33;
-   WriteLn('(SHR) Value should be 32767...',longres);
+   Write('(SHR) Value should be 32767...');
+   if longres = 32767 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    { left : LOC_REFERENCE }
    { right : LOC_REFERENCE }
    WriteLn('(left) : LOC_REFERENCE; (right) : LOC_REFERENCE');
+
    longres := 1;
    longcnt := -2;
    longres:=longres shl longcnt ;
-   WriteLn('(SHL) Value should be 1073741824...',longres);
+   Write('(SHL) Value should be 1073741824...');
+   if longres = 1073741824 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres:=1;
    longcnt:=15;
    longres := longres shl longcnt;
-   WriteLn('(SHL) Value should be 32768...',longres);
+   Write('(SHL) Value should be 32768...');
+   if longres = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    longres:=-1;
    longcnt := 15;
    longres := longres shl longcnt;
-   WriteLn('(SHL) Value should be -32768...',longres);
+   Write('(SHL) Value should be -32768...');
+   if longres = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres := 1;
    longcnt := -2;
    longres:=longres shr longcnt ;
-   WriteLn('(SHR) Value should be 0...',longres);
+   Write('(SHR) Value should be 0...');
+   if longres = 0 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres:=32768;
    longcnt:=15;
    longres := longres shr longcnt;
-   WriteLn('(SHR) Value should be 1...',longres);
+   Write('(SHR) Value should be 1...');
+   if longres = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
    longres:=-1;
    longcnt := 15;
    longres := longres shl longcnt;
-   WriteLn('(SHR) Value should be -32768...',longres);
-
+   Write('(SHR) Value should be -32768...');
+   if longres = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    { left : LOC_REFERENCE }
    { right : LOC_REGISRER }
-
    WriteLn('(left) : LOC_REFERENCE; (right) : LOC_REGISTER');
    longres := 1;
    bytecnt := -2;
    longres:=longres shl bytecnt ;
-   WriteLn('(SHL) Value should be 1073741824...',longres);
+   Write('(SHL) Value should be 1073741824...');
+   if longres = 1073741824 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres:=1;
    bytecnt:=15;
    longres := longres shl bytecnt;
-   WriteLn('(SHL) Value should be 32768...',longres);
+   Write('(SHL) Value should be 32768...');
+   if longres = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    longres:=-1;
    bytecnt := 15;
    longres := longres shl bytecnt;
-   WriteLn('(SHL) Value should be -32768...',longres);
+   Write('(SHL) Value should be -32768...');
+   if longres = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres := 1;
    bytecnt := -2;
    longres:=longres shr bytecnt ;
-   WriteLn('(SHR) Value should be 0...',longres);
+   Write('(SHR) Value should be 0...');
+   if longres = 0 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    longres:=32768;
    bytecnt:=15;
    longres := longres shr bytecnt;
-   WriteLn('(SHR) Value should be 1...',longres);
+   Write('(SHR) Value should be 1...');
+   if longres = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    longres:=-1;
    bytecnt := 15;
    longres := longres shr bytecnt;
-   WriteLn('(SHR) Value should be 131071...',longres);
-
+   Write('(SHR) Value should be 131071...');
+   if longres = 131071 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    WriteLn('(left) : LOC_REGISTER; (right) : LOC_REGISTER');
    byteres := 1;
    bytecnt := 2;
    byteres := byteres shl bytecnt;
-   WriteLn('(SHL) Value should be 4...',byteres);
+   Write('(SHL) Value should be 4...');
+   if longres = 4 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 
    byteres := 4;
    bytecnt := 2;
    byteres := byteres shr bytecnt;
-   WriteLn('(SHR) Value should be 1...',byteres);
+   Write('(SHR) Value should be 1...');
+   if longres = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
 {$IFDEF FPC}
    WriteLn('------------------------------  INT64  --------------------------------');
-
    { left : LOC_REFERENCE     }
    { right : numeric constant }
    WriteLn('(left) : LOC_REFERENCE; (right) : ordinal constant');
    int64res:=1;
    int64res := int64res shl 15;
-   WriteLn('(SHL) Value should be 32768...',int64res);
+   Write('(SHL) Value should be 32768...');
+   if int64res = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    int64res:=-1;
    int64res := int64res shl 15;
-   WriteLn('(SHL) Value should be -32768...',int64res);
+   Write('(SHL) Value should be -32768...');
+   if int64res = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
+
    int64res:=1;
    int64res := int64res shl 65;
-   WriteLn('(SHL) Value should be 2...',int64res);
+   Write('(SHL) Value should be 2...');
+   if int64res = 2 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    int64res:=$8000;
    int64res := int64res shr 15;
-   WriteLn('(SHR) Value should be 1...',int64res);
+   Write('(SHR) Value should be 1...');
+   if int64res = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 {   int64res:=-1;
    int64res := int64res shr 15;
-   WriteLn('(SHR) Value should be 131071...',int64res);}
+   Write('(SHR) Value should be 131071...');}
    int64res:=$FFFF;
    int64res := int64res shr 65;
-   WriteLn('(SHR) Value should be 0...',int64res);
+   Write('(SHR) Value should be 0...');
+   if int64res = 0 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    { left : LOC_REFERENCE }
    { right : LOC_REFERENCE }
@@ -171,59 +279,110 @@ Begin
    int64res := 1;
    int64cnt := -2;
    int64res:=int64res shl int64cnt ;
-   WriteLn('(SHL) Value should be 1073741824...',int64res);
+   Write('(SHL) Value should be 1073741824...');
+   if int64res = 1073741824 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    int64res:=1;
    int64cnt:=15;
    int64res := int64res shl int64cnt;
-   WriteLn('(SHL) Value should be 32768...',int64res);
+   Write('(SHL) Value should be 32768...');
+   if int64res = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
+
    int64res:=-1;
    int64cnt := 15;
    int64res := int64res shl int64cnt;
-   WriteLn('(SHL) Value should be -32768...',int64res);
+   Write('(SHL) Value should be -32768...');
+   if int64res = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 
    int64res := 1;
    int64cnt := -2;
    int64res:=int64res shr int64cnt ;
-   WriteLn('(SHR) Value should be 0...',int64res);
+   Write('(SHR) Value should be 0...');
+   if int64res = 0 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    int64res:=32768;
    int64cnt:=15;
    int64res := int64res shr int64cnt;
-   WriteLn('(SHR) Value should be 1...',int64res);
+   Write('(SHR) Value should be 1...');
+   if int64res = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
    int64res:=-1;
    int64cnt := 15;
    int64res := int64res shl int64cnt;
-   WriteLn('(SHR) Value should be -32768...',int64res);
-
+   Write('(SHR) Value should be -32768...');
+   if int64res = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 
    { left : LOC_REFERENCE }
    { right : LOC_REGISRER }
-
    WriteLn('(left) : LOC_REFERENCE; (right) : LOC_REGISTER');
    int64res := 1;
    bytecnt := -2;
    int64res:=int64res shl bytecnt ;
-   WriteLn('(SHL) Value should be 1073741824...',int64res);
+   Write('(SHL) Value should be 1073741824...');
+   if int64res = 1073741824 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 
    int64res:=1;
    bytecnt:=15;
    int64res := int64res shl bytecnt;
-   WriteLn('(SHL) Value should be 32768...',int64res);
+   Write('(SHL) Value should be 32768...');
+   if int64res = 32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
+
    int64res:=-1;
    bytecnt := 15;
    int64res := int64res shl bytecnt;
-   WriteLn('(SHL) Value should be -32768...',int64res);
+   Write('(SHL) Value should be -32768...');
+   if int64res = -32768 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 
    int64res := 1;
    bytecnt := -2;
    int64res:=int64res shr bytecnt ;
-   WriteLn('(SHR) Value should be 0...',int64res);
+   Write('(SHR) Value should be 0...');
+   if int64res = 0 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
+
 
    int64res:=32768;
    bytecnt:=15;
    int64res := int64res shr bytecnt;
-   WriteLn('(SHR) Value should be 1...',int64res);
+   Write('(SHR) Value should be 1...');
+   if int64res = 1 then
+     WriteLn('Success.')
+   else
+     WriteLn('Failure.');
 {   int64res:=-1;
    bytecnt := 15;
    int64res := int64res shr bytecnt;