TestDivide.mesa
December 8, 1986 3:05:11 pm PST
Last Edited by: Ross December 8, 1986 6:19:05 pm PST
DIRECTORY Basics, TamarinDivide;
TestDivide: CEDAR PROGRAM
IMPORTS Basics, TamarinDivide =
BEGIN
BadResult: SIGNAL [] = CODE;
refQuotient: INT;
refRemainder: INT;
testQuotient: INT;
testRemainder: INT;
testOK: BOOL;
FOR i: CARDINAL IN [1..1500] DO
FOR j: CARD IN [1..32767] DO
[refQuotient, refRemainder] ← Basics.LongDivMod[j, i];
[testQuotient, testRemainder, testOK] ← TamarinDivide.Divide[i, j];
IF (refQuotient # testQuotient) OR (refRemainder # testRemainder) THEN SIGNAL BadResult[];
ENDLOOP;
ENDLOOP;
END.