<< This definitions module is meant to test INLINE procedures. It contains a private and a public INLINE as well simple constants, variables, and types to test with. XMesaCmplr10Defs2's implementation modules are ModA and ModC. >>
BEGIN
header200, header300, dc, u, iget, ur, ua, done: LONG STRING;
i1: INTEGER = 1;
i2: INTEGER;
c1: CARDINAL =1;
c2: CARDINAL;
r1: REAL = 1.0;
r2: REAL;
char1: CHAR = 'a;
char2: CHAR;
b1: BOOLEAN = TRUE;
b2: BOOLEAN;
SimplRecord:
TYPE =
RECORD[
anInt: INTEGER,
aCard: CARDINAL,
aReal: REAL,
aChar: CHAR,
aBool: BOOLEAN];
iArray: TYPE = ARRAY [0..5] OF INTEGER;
cArray: TYPE = ARRAY [0..5] OF CARDINAL;
rArray: TYPE = ARRAY [0..5] OF REAL;
charArray: TYPE = ARRAY [0..5] OF CHAR;
bArray: TYPE = ARRAY [0..5] OF BOOLEAN;
Geti: PROCEDURE RETURNS[INTEGER];
Getc: PROCEDURE RETURNS[CARDINAL];
Getr: PROCEDURE RETURNS[REAL];
Getchar: PROCEDURE RETURNS[CHAR];
Getb: PROCEDURE RETURNS[BOOLEAN];
MyInlineProc: PROCEDURE[] = INLINE
BEGIN
initialization of record and arrays.
testRecord: XMesaCmplr10Defs1.SimplRecord ¬ [18,18,18.0,'r,FALSE];
iTestArray: XMesaCmplr10Defs1.iArray ¬ ALL[2];
cTestArray: XMesaCmplr10Defs1.cArray ¬ ALL[2];
rTestArray: XMesaCmplr10Defs1.rArray ¬ ALL[2.0];
charTestArray: XMesaCmplr10Defs1.charArray ¬ ALL['b];
bTestArray: XMesaCmplr10Defs1.bArray ¬ ALL[FALSE];
XMesaProcs.PrintCR[];
XMesaProcs.PrintS[header200];
XMesaProcs.PrintCR;
integer tests.
XMesaProcs.Isequal[XMesaCmplr10Defs1.i1,1,200,dc];
XMesaCmplr10Defs1.i2 ¬ 1;
XMesaProcs.Isequal[XMesaCmplr10Defs1.i2,1,201,u];
XMesaCmplr10Defs1.i2 ¬ XMesaCmplr10Defs1.Geti[];
XMesaProcs.Isequal[XMesaCmplr10Defs1.i2,2,202,iget];
cardinal tests.
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c1,1,210,dc];
XMesaCmplr10Defs1.c2 ¬ 1;
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c2,1,211,u];
XMesaCmplr10Defs1.c2 ¬ XMesaCmplr10Defs1.Getc[];
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c2,2,212,iget];
real tests.
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r1,1.0,220,dc];
XMesaCmplr10Defs1.r2 ¬ 1.0;
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r2,1.0,221,u];
XMesaCmplr10Defs1.r2 ¬ XMesaCmplr10Defs1.Getr[];
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r2,2.0,222,iget];
character tests
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char1,'a,230,dc];
XMesaCmplr10Defs1.char2 ¬ 'a;
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char2,'a,231,u];
XMesaCmplr10Defs1.char2 ¬ XMesaCmplr10Defs1.Getchar[];
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char2,'b,232,iget];
boolean tests.
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b1,TRUE,240,dc];
XMesaCmplr10Defs1.b2 ¬ TRUE;
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b2,TRUE,241,u];
XMesaCmplr10Defs1.b2 ¬ XMesaCmplr10Defs1.Getb[];
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b2,FALSE,242,iget];
testRecord is initialized above.
XMesaProcs.Isequal[testRecord.anInt,18,203,ur];
XMesaProcs.IsCardequal[testRecord.aCard,18,213,ur];
XMesaProcs.Isrealequal[testRecord.aReal,18.0,223,ur];
XMesaProcs.Ischarequal[testRecord.aChar,'r,233,ur];
XMesaProcs.Isboolequal[testRecord.aBool,FALSE,243,ur];
#TestArrays are initialized above.
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isequal[iTestArray[i],2,204,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.IsCardequal[cTestArray[i],2,214,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isrealequal[rTestArray[i],2.0,224,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Ischarequal[charTestArray[i],'b,234,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isboolequal[bTestArray[i],FALSE,244,ua];
ENDLOOP;
XMesaProcs.PrintS[done];
MyPrivateInline[];
END;
MyPrivateInline: PRIVATE PROCEDURE[] = INLINE
BEGIN
initialization of record and arrays.
testRecord: SimplRecord ¬ [18,18,18.0,'r,FALSE];
iTestArray: iArray ¬ ALL[2];
cTestArray: cArray ¬ ALL[2];
rTestArray: rArray ¬ ALL[2.0];
charTestArray: charArray ¬ ALL['b];
bTestArray: bArray ¬ ALL[FALSE];
XMesaProcs.PrintCR[];
XMesaProcs.PrintS[header300];
XMesaProcs.PrintCR;
integer tests.
XMesaProcs.Isequal[i1,1,300,dc];
i2 ¬ 1;
XMesaProcs.Isequal[i2,1,301,u];
i2 ¬ Geti[];
XMesaProcs.Isequal[i2,2,302,iget];
cardinal tests.
XMesaProcs.IsCardequal[c1,1,310,dc];
c2 ¬ 1;
XMesaProcs.IsCardequal[c2,1,311,u];
c2 ¬ Getc[];
XMesaProcs.IsCardequal[c2,2,312,iget];
real tests.
XMesaProcs.Isrealequal[r1,1.0,320,dc];
r2 ¬ 1.0;
XMesaProcs.Isrealequal[r2,1.0,321,u];
r2 ¬ Getr[];
XMesaProcs.Isrealequal[r2,2.0,322,iget];
character tests
XMesaProcs.Ischarequal[char1,'a,330,dc];
char2 ¬ 'a;
XMesaProcs.Ischarequal[char2,'a,331,u];
char2 ¬ Getchar[];
XMesaProcs.Ischarequal[char2,'b,332,iget];
boolean tests.
XMesaProcs.Isboolequal[b1,TRUE,340,dc];
b2 ¬ TRUE;
XMesaProcs.Isboolequal[b2,TRUE,341,u];
b2 ¬ Getb[];
XMesaProcs.Isboolequal[b2,FALSE,342,iget];
testRecord is initialized above.
XMesaProcs.Isequal[testRecord.anInt,18,303,ur];
XMesaProcs.IsCardequal[testRecord.aCard,18,313,ur];
XMesaProcs.Isrealequal[testRecord.aReal,18.0,323,ur];
XMesaProcs.Ischarequal[testRecord.aChar,'r,333,ur];
XMesaProcs.Isboolequal[testRecord.aBool,FALSE,343,ur];
#TestArrays are initialized above.
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isequal[iTestArray[i],2,304,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.IsCardequal[cTestArray[i],2,314,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isrealequal[rTestArray[i],2.0,324,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Ischarequal[charTestArray[i],'b,334,ua];
ENDLOOP;
FOR i:
INTEGER
IN [0..5]
DO
XMesaProcs.Isboolequal[bTestArray[i],FALSE,344,ua];
ENDLOOP;
XMesaProcs.PrintS[done];
END;