Google
 

Trailing-Edge - PDP-10 Archives - BB-P557A-BM_1983 - uetp/lib/pas0.pas
There are no other files named pas0.pas in the archive.
(*LANG:<KOHLBRENNER.TST>PAS0.PAS.2 19-Aug-81 09:06:14, Edit by KOHLBRENNER *)
(* COPYRIGHT (C) 1983 BY DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASS. *)
{+TEST  }
{D Tests relation conditions on simple variables in simple IF}
{D statements.  This a prerequisite for writing self-checking}
{D programs.}
{D Variables are compared against other variables, constants,}
{D and named constants.  Relation operators include equality,}
{D inequality, ranking, and conditions are arranged so that both}
{D true and false paths of the IF are taken.  IF statements with}
{D and without an ELSE path are used.}
{D There are enough variables, and variable references are}
{D intermixed enough so that register optimization will be possible}
{D but not on all variables.}
{-TEST  }
PROGRAM ac0020 (INPUT, OUTPUT);

CONST
	gczero = 0;
	gcplusone = 1;
	gcminusone = -1;
	gcplusmaxint = MAXINT;
	gcminusmaxint = -MAXINT;

	gctrue = TRUE;
	gcfalse = FALSE;

	gca = 'a';
	gcz = 'z';
	gcaupper = 'A';
	gczupper = 'Z';
	gc0 = '0';
	gc9 = '9';


VAR
	gvzero : INTEGER;
	gvplusone : INTEGER;
	gvminusone : INTEGER;
	gvplusmaxint : INTEGER;
	gvminusmaxint : INTEGER;

	gvtrue : BOOLEAN;
	gvfalse : BOOLEAN;

	gva : CHAR;
	gvz : CHAR;
	gvaupper : CHAR;
	gvzupper : CHAR;
	gvnull : CHAR;
	gv0 : CHAR;
	gv9 : CHAR;

BEGIN
	{ Initialize all variables }
	gvzero := 0;
	gvplusone := 1;
	gvminusone := -1;
	gvplusmaxint := MAXINT;
	gvminusmaxint := -MAXINT;

	gvtrue := TRUE;
	gvfalse := FALSE;

	gva := 'a';
	gvz := 'z';
	gvaupper := 'A';
	gvzupper := 'Z';
	gvnull := CHR (0);
	gv0 := '0';
	gv9 := '9';

	{ Relation tests, both variables, equality, false }
	{ integers }
	IF gvzero = gvplusone THEN WRITELN ('?001');
	IF gvzero = gvminusone THEN WRITELN ('?002');
	IF gvzero = gvplusmaxint THEN WRITELN ('?003');
	IF gvzero = gvminusmaxint THEN WRITELN ('?004');
	IF gvplusmaxint = gvminusmaxint THEN WRITELN ('?005');
	IF gvplusone = gvminusone THEN WRITELN ('?006');
	IF gvminusone = gvminusmaxint THEN WRITELN ('?007');
	IF gvplusone = gvplusmaxint THEN WRITELN ('?008');

	IF gvtrue = gvfalse THEN WRITELN ('?009');

	IF gva = gvz THEN WRITELN ('?010');
	IF gvaupper = gv0 THEN WRITELN ('?011');
	IF gvzupper = gv9 THEN WRITELN ('?012');
	IF gvnull = gvz THEN WRITELN ('?013');

	{ Relation tests, both variables, inequality, false }

	IF gvzero <> gvplusone THEN WRITELN ('021') ELSE WRITELN ('?021');
	IF gvzero <> gvminusone THEN WRITELN ('022') ELSE WRITELN ('?022');
	IF gvzero <> gvplusmaxint THEN WRITELN ('023') ELSE WRITELN ('?023');
	IF gvzero <> gvminusmaxint THEN WRITELN ('024') ELSE WRITELN ('?024');
	IF gvplusmaxint <> gvminusmaxint THEN WRITELN ('025') ELSE WRITELN ('?025');
	IF gvplusone <> gvminusone THEN WRITELN ('026') ELSE WRITELN ('?026');
	IF gvminusone <> gvminusmaxint THEN WRITELN ('027') ELSE WRITELN ('?027');
	IF gvplusone <> gvplusmaxint THEN WRITELN ('028') ELSE WRITELN ('?028');

	IF gvtrue <> gvfalse THEN WRITELN ('029') ELSE WRITELN ('?029');

	IF gva <> gvz THEN WRITELN ('030') ELSE WRITELN ('?030');
	IF gvaupper <> gv0 THEN WRITELN ('031') ELSE WRITELN ('?031');
	IF gvzupper <> gv9 THEN WRITELN ('032') ELSE WRITELN ('?032');
	IF gvnull <> gvz THEN WRITELN ('033') ELSE WRITELN ('?033');

	{ Relation tests, both variables, ranking, false }

	IF gvzero >= gvplusone THEN WRITELN ('?041 ');
	IF gvzero <= gvminusone THEN WRITELN ('?042 ');
	IF gvzero >= gvplusmaxint THEN WRITELN ('?043 ');
	IF gvzero <= gvminusmaxint THEN WRITELN ('?044 ');
	IF gvplusmaxint <= gvminusmaxint THEN WRITELN ('?045 ');
	IF gvplusone <= gvminusone THEN WRITELN ('?046 ');
	IF gvminusone <= gvminusmaxint THEN WRITELN ('?047 ');
	IF gvplusone >= gvplusmaxint THEN WRITELN ('?048 ');

	IF gvfalse >= gvtrue THEN WRITELN ('?049 ');

	IF gva >= gvz THEN WRITELN ('?050 ');
	IF gvaupper <= gv0 THEN WRITELN ('?051 ');
	IF gvzupper <= gv9 THEN WRITELN ('?052 ');
	IF gvnull >= gvz THEN WRITELN ('?053 ');

	{ Relation tests, both variables, ranking,  true }

	IF gvzero < gvplusone THEN WRITELN ('061') ELSE WRITELN ('?061');
	IF gvzero > gvminusone THEN WRITELN ('062') ELSE WRITELN ('?062');
	IF gvzero < gvplusmaxint THEN WRITELN ('063') ELSE WRITELN ('?063');
	IF gvzero > gvminusmaxint THEN WRITELN ('064') ELSE WRITELN ('?064');
	IF gvplusmaxint > gvminusmaxint THEN WRITELN ('065') ELSE WRITELN ('?065');
	IF gvplusone > gvminusone THEN WRITELN ('066') ELSE WRITELN ('?066');
	IF gvminusone > gvminusmaxint THEN WRITELN ('067') ELSE WRITELN ('?067');
	IF gvplusone < gvplusmaxint THEN WRITELN ('068') ELSE WRITELN ('?068');

	IF gvfalse < gvtrue THEN WRITELN ('069') ELSE WRITELN ('?069');

	IF gva < gvz THEN WRITELN ('070') ELSE WRITELN ('?070');
	IF gvaupper > gv0 THEN WRITELN ('071') ELSE WRITELN ('?071');
	IF gvzupper > gv9 THEN WRITELN ('072') ELSE WRITELN ('?072');
	IF gvnull < gvz THEN WRITELN ('073') ELSE WRITELN ('?073');

	{ Relation tests, variable and constant, equality, false }
	{ integers }
	IF gvzero = 1 THEN WRITELN ('?101');
	IF gvzero = -1 THEN WRITELN ('?102');
	IF 0 = gvplusmaxint THEN WRITELN ('?103');
	IF 0 = gvminusmaxint THEN WRITELN ('?104');
	IF 32767 = gvminusmaxint THEN WRITELN ('?105');
	IF 1 = gvminusone THEN WRITELN ('?106');
	IF gvminusone = -32768 THEN WRITELN ('?107');
	IF +1 = gvplusmaxint THEN WRITELN ('?108');

	IF gvtrue = FALSE THEN WRITELN ('?109');

	IF 'a' = gvz THEN WRITELN ('?110');
	IF gvaupper = '0' THEN WRITELN ('?111');
	IF 'Z' = gv9 THEN WRITELN ('?112');
	IF gvnull = 'z' THEN WRITELN ('?113');

	{ Relation tests, variable and constant, inequality, false }

	IF 0 <> gvplusone THEN WRITELN ('121') ELSE WRITELN ('?121');
	IF 0 <> gvminusone THEN WRITELN ('122') ELSE WRITELN ('?122');
	IF gvzero <> MAXINT THEN WRITELN ('123') ELSE WRITELN ('?123');
	IF gvzero <> - MAXINT THEN WRITELN ('124') ELSE WRITELN ('?124');
	IF MAXINT <> gvminusmaxint THEN WRITELN ('125') ELSE WRITELN ('?125');
	IF gvplusone <> -1 THEN WRITELN ('126') ELSE WRITELN ('?126');
	IF -1 <> gvminusmaxint THEN WRITELN ('127') ELSE WRITELN ('?127');
	IF gvplusone <> MAXINT THEN WRITELN ('128') ELSE WRITELN ('?128');

	IF gvtrue <> FALSE THEN WRITELN ('129') ELSE WRITELN ('?129');

	IF gva <> 'z' THEN WRITELN ('130') ELSE WRITELN ('?130');
	IF 'A' <> gv0 THEN WRITELN ('131') ELSE WRITELN ('?131');
	IF 'Z' <> gv9 THEN WRITELN ('132') ELSE WRITELN ('?132');
	IF gvnull <> 'z' THEN WRITELN ('133') ELSE WRITELN ('?133');

	{ Relation tests, variable and constant, ranking, false }

	IF 0 >= gvplusone THEN WRITELN ('?141 ');
	IF gvzero <= -1 THEN WRITELN ('?142 ');
	IF gvzero >= MAXINT THEN WRITELN ('?143 ');
	IF gvzero <= -MAXINT THEN WRITELN ('?144 ');
	IF MAXINT <= gvminusmaxint THEN WRITELN ('?145 ');
	IF +1 <= gvminusone THEN WRITELN ('?146 ');
	IF -1 <= gvminusmaxint THEN WRITELN ('?147 ');
	IF +(1) >= gvplusmaxint THEN WRITELN ('?148 ');

	IF gvfalse >= TRUE THEN WRITELN ('?149 ');

	IF 'a' >= gvz THEN WRITELN ('?150 ');
	IF gvaupper <= '0' THEN WRITELN ('?151 ');
	IF gvzupper <= '9' THEN WRITELN ('?152 ');
	IF gvnull >= 'z' THEN WRITELN ('?153 ');

	{ Relation tests, variable and constant, ranking,  true }

	IF gvzero < +( 1 ) THEN WRITELN ('161') ELSE WRITELN ('?161');
	IF gvzero > - ( +1 ) THEN WRITELN ('162') ELSE WRITELN ('?162');
	IF 0 < gvplusmaxint THEN WRITELN ('163') ELSE WRITELN ('?163');
	IF 0 > gvminusmaxint THEN WRITELN ('164') ELSE WRITELN ('?164');
	IF + (MAXINT) > gvminusmaxint THEN WRITELN ('165') ELSE WRITELN ('?165');
	IF + ( +1 ) > gvminusone THEN WRITELN ('166') ELSE WRITELN ('?166');
	IF + ( -1 ) > gvminusmaxint THEN WRITELN ('167') ELSE WRITELN ('?167');
	IF 1 < gvplusmaxint THEN WRITELN ('168') ELSE WRITELN ('?168');

	IF FALSE < gvtrue THEN WRITELN ('169') ELSE WRITELN ('?169');

	IF gva < 'z' THEN WRITELN ('170') ELSE WRITELN ('?170');
	IF gvaupper > '0' THEN WRITELN ('171') ELSE WRITELN ('?171');
	IF 'Z' > gv9 THEN WRITELN ('172') ELSE WRITELN ('?172');
	IF gvnull < 'z' THEN WRITELN ('173') ELSE WRITELN ('?173');

	{ Relation tests, variable and named constants, equality, false }
	{ integers }
	IF gczero = gvplusone THEN WRITELN ('?201');
	IF gczero = gvminusone THEN WRITELN ('?202');
	IF gczero = gvplusmaxint THEN WRITELN ('?203');
	IF gczero = gvminusmaxint THEN WRITELN ('?204');
	IF gcplusmaxint = gvminusmaxint THEN WRITELN ('?205');
	IF gcplusone = gvminusone THEN WRITELN ('?206');
	IF gcminusone = gvminusmaxint THEN WRITELN ('?207');
	IF gcplusone = gvplusmaxint THEN WRITELN ('?208');

	IF gctrue = gvfalse THEN WRITELN ('?209');

	IF gca = gvz THEN WRITELN ('?210');
	IF gcaupper = gv0 THEN WRITELN ('?211');
	IF gczupper = gv9 THEN WRITELN ('?212');
	IF gvnull = gcz THEN WRITELN ('?213');

	{ Relation tests, variable and named constants, inequality, false }

	IF gczero <> gvplusone THEN WRITELN ('221') ELSE WRITELN ('?221');
	IF gczero <> gvminusone THEN WRITELN ('222') ELSE WRITELN ('?222');
	IF gczero <> gvplusmaxint THEN WRITELN ('223') ELSE WRITELN ('?223');
	IF gczero <> gvminusmaxint THEN WRITELN ('224') ELSE WRITELN ('?224');
	IF gcplusmaxint <> gvminusmaxint THEN WRITELN ('225') ELSE WRITELN ('?225');
	IF gcplusone <> gvminusone THEN WRITELN ('226') ELSE WRITELN ('?226');
	IF gcminusone <> gvminusmaxint THEN WRITELN ('227') ELSE WRITELN ('?227');
	IF gcplusone <> gvplusmaxint THEN WRITELN ('228') ELSE WRITELN ('?228');

	IF gctrue <> gvfalse THEN WRITELN ('229') ELSE WRITELN ('?229');

	IF gca <> gvz THEN WRITELN ('230') ELSE WRITELN ('?230');
	IF gcaupper <> gv0 THEN WRITELN ('231') ELSE WRITELN ('?231');
	IF gczupper <> gv9 THEN WRITELN ('232') ELSE WRITELN ('?232');
	IF gvnull <> gcz THEN WRITELN ('233') ELSE WRITELN ('?233');

	{ Relation tests, variable and named constants, ranking, false }

	IF gczero >= gvplusone THEN WRITELN ('?241 ');
	IF gczero <= gvminusone THEN WRITELN ('?242 ');
	IF gczero >= gvplusmaxint THEN WRITELN ('?243 ');
	IF gczero <= gvminusmaxint THEN WRITELN ('?244 ');
	IF gcplusmaxint <= gvminusmaxint THEN WRITELN ('?245 ');
	IF gcplusone <= gvminusone THEN WRITELN ('?246 ');
	IF gcminusone <= gvminusmaxint THEN WRITELN ('?247 ');
	IF gcplusone >= gvplusmaxint THEN WRITELN ('?248 ');

	IF gvfalse >= gctrue THEN WRITELN ('?249 ');

	IF gca >= gvz THEN WRITELN ('?250 ');
	IF gcaupper <= gv0 THEN WRITELN ('?251 ');
	IF gczupper <= gv9 THEN WRITELN ('?252 ');
	IF gvnull >= gcz THEN WRITELN ('?253 ');

	{ Relation tests, variable and named constants, ranking,  true }

	IF gczero < gvplusone THEN WRITELN ('261') ELSE WRITELN ('?261');
	IF gczero > gvminusone THEN WRITELN ('262') ELSE WRITELN ('?262');
	IF gczero < gvplusmaxint THEN WRITELN ('263') ELSE WRITELN ('?263');
	IF gczero > gvminusmaxint THEN WRITELN ('264') ELSE WRITELN ('?264');
	IF gcplusmaxint > gvminusmaxint THEN WRITELN ('265') ELSE WRITELN ('?265');
	IF gcplusone > gvminusone THEN WRITELN ('266') ELSE WRITELN ('?266');
	IF gcminusone > gvminusmaxint THEN WRITELN ('267') ELSE WRITELN ('?267');
	IF gcplusone < gvplusmaxint THEN WRITELN ('268') ELSE WRITELN ('?268');

	IF gvfalse < gctrue THEN WRITELN ('269') ELSE WRITELN ('?269');

	IF gca < gvz THEN WRITELN ('270') ELSE WRITELN ('?270');
	IF gcaupper > gv0 THEN WRITELN ('271') ELSE WRITELN ('?271');
	IF gczupper > gv9 THEN WRITELN ('272') ELSE WRITELN ('?272');
	IF gvnull < gcz THEN WRITELN ('273') ELSE WRITELN ('?273');

	WRITELN ('Done');
end.