XMesaCmplr10b.mesa 17-Aug-87 18:36:08
Jim Foote January 22, 1988 1:49:38 pm PST
Mna, April 17, 1991 3:28 pm PDT
<<This module assigns values to variables and constants of various simple types ( INTEGER CARDINAL REAL CHAR BOOLEAN ) and then reads these values back out to compare with what should have been assigned. Also checks accuracy of record default values. >>
DIRECTORY
RunRegressions,
XMesaCmplr10Defs1,
XMesaProcs;
XMesaCmplr10b: PROGRAM
IMPORTS RunRegressions, XMesaCmplr10Defs1, XMesaProcs =
BEGIN
XMesaCall10: PROCEDURE = {
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["ModB compiler tests."];
XMesaProcs.PrintCR;
integer tests.
XMesaProcs.Isequal[XMesaCmplr10Defs1.i1,1,100,"Defs CONSTANT INT."];
XMesaCmplr10Defs1.i2 ¬ 1;
XMesaProcs.Isequal[XMesaCmplr10Defs1.i2,1,101,"INT var."];
XMesaCmplr10Defs1.i2 ¬ XMesaCmplr10Defs1.Geti[];
XMesaProcs.Isequal[XMesaCmplr10Defs1.i2,2,102,"Imported GetINT"];
cardinal tests.
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c1,1,110,"Defs CONSTANT CARD."];
XMesaCmplr10Defs1.c2 ¬ 1;
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c2,1,111,"CARD var."];
XMesaCmplr10Defs1.c2 ¬ XMesaCmplr10Defs1.Getc[];
XMesaProcs.IsCardequal[XMesaCmplr10Defs1.c2,2,112,"Imported GetCARD"];
real tests.
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r1,1.0,120,"Defs CONSTANT REAL."];
XMesaCmplr10Defs1.r2 ¬ 1.0;
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r2,1.0,121,"REAL var."];
XMesaCmplr10Defs1.r2 ¬ XMesaCmplr10Defs1.Getr[];
XMesaProcs.Isrealequal[XMesaCmplr10Defs1.r2,2.0,122,"Imported GetREAL"];
character tests
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char1,'a,130,"Defs CONSTANT CHARACTER."];
XMesaCmplr10Defs1.char2 ¬ 'a;
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char2,'a,131,"CHARACTER var."];
XMesaCmplr10Defs1.char2 ¬ XMesaCmplr10Defs1.Getchar[];
XMesaProcs.Ischarequal[XMesaCmplr10Defs1.char2,'b,132,"Imported GetCHARACTER"];
boolean tests.
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b1,TRUE,140,"Defs CONSTANT BOOLEAN."];
XMesaCmplr10Defs1.b2 ¬ TRUE;
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b2,TRUE,141,"BOOLEAN var."];
XMesaCmplr10Defs1.b2 ¬ XMesaCmplr10Defs1.Getb[];
XMesaProcs.Isboolequal[XMesaCmplr10Defs1.b2,FALSE,142,"Imported GetBOOLEAN"];
testRecord is initialized above.
XMesaProcs.Isequal[testRecord.anInt,18,103,"INT in REC"];
XMesaProcs.IsCardequal[testRecord.aCard,18,113,"CARD in REC"];
XMesaProcs.Isrealequal[testRecord.aReal,18.0,123,"REAL in REC"];
XMesaProcs.Ischarequal[testRecord.aChar,'r,133,"CHAR in REC"];
XMesaProcs.Isboolequal[testRecord.aBool,FALSE,143,"BOOL in REC"];
#TestArrays are initialized above.
FOR i: INTEGER IN [0..5] DO
XMesaProcs.Isequal[iTestArray[i],2,104,"INT in ARRAY"];
ENDLOOP;
FOR i: INTEGER IN [0..5] DO
XMesaProcs.IsCardequal[cTestArray[i],2,114,"CARD in ARRAY"];
ENDLOOP;
FOR i: INTEGER IN [0..5] DO
XMesaProcs.Isrealequal[rTestArray[i],2.0,124,"REAL in ARRAY"];
ENDLOOP;
FOR i: INTEGER IN [0..5] DO
XMesaProcs.Ischarequal[charTestArray[i],'b,134,"CHAR in ARRAY"];
ENDLOOP;
FOR i: INTEGER IN [0..5] DO
XMesaProcs.Isboolequal[bTestArray[i],FALSE,144,"BOOL in ARRAY"];
ENDLOOP;
XMesaProcs.PrintS["Done."];
};
RunRegressions.RegisterTest[XMesaCall10, "test10"];
END.