BitOpsTest.mesa
Last edited by: Barth, December 8, 1983 10:29 am
Last Edited by: Spreitzer, May 3, 1985 2:50:47 pm PDT
DIRECTORY BitOps, BitSwOps, IO, SwitchTypes, ViewerIO;
BitOpsTest: CEDAR PROGRAM
IMPORTS BitOps, BitSwOps, IO, ViewerIO =
BEGIN
SimpleTest: PROC =
TRUSTED BEGIN OPEN BitSwOps, BitOps, IO;
none: SwitchTypes.Strength = SwitchTypes.none;
out: IO.STREAM ← ViewerIO.CreateViewerStreams["BitOpsTest"].out;
b: BOOL;
c: CARDINAL;
at: ARRAY [0..4) OF CARDINAL;
a: BitMWord ← DESCRIPTOR[at];
s1, s2: PACKED ARRAY [0 .. 7) OF SwitchTypes.SwitchVal;
sd1: SwitchMWord = DESCRIPTOR[s1];
sd2: SwitchMWord = DESCRIPTOR[s2];
FOR i:CARDINAL IN [0..4) DO
at[i] ← 125252B;
ENDLOOP;
IF NOT (b ← EBFW[6,4,1]) THEN out.PutF["First EBFW failed with %b when expecting TRUE ", bool[b]];
IF (c ← IBIW[TRUE,6,4,3]) # 7B THEN out.PutF["First IBIW failed with %b when expecting 7 ", card[c]];
IF NOT (b ← EBFM[a,64,62]) THEN out.PutF["First EBFM failed with %b when expecting TRUE ", bool[b]];
IBIM[FALSE,a,64,62];
IF a[3] # 125250B THEN out.PutF["First IBIM failed with %b when expecting 125250B ", card[a[3]]];
IF (c ← ECFW[1,16,4,12]) # 1 THEN out.PutF["ECFW failed with %b when expecting 1 ", card[c]];
IF (c ← ICIW[1,1,16,0,1]) # 100001B THEN out.PutF["ICIW failed with %b when expecting 100001B ", card[c]];
IF (c ← ECFM[a,64,58,6]) # 50B THEN out.PutF["ECFM failed with %b when expecting 50B ", card[c]];
ICIM[1,a,64,62,1];
IF a[3] # 125252B THEN out.PutF["ICIM failed with %b when expecting 125252B ", card[a[3]]];
ICIS[source: 85, container: sd1, containerWidth: 7, fieldPosition: 0, fieldWidth: 7, si: q, how: [charge, drive]];
ICIS[source: 51, container: sd1, containerWidth: 7, fieldPosition: 0, fieldWidth: 7, si: u, how: [none, input]];
ICIS[source: 71, container: sd1, containerWidth: 7, fieldPosition: 0, fieldWidth: 7, si: d, how: [driveWeak, chargeStrong]];
MSTS[sourceContainer: sd1, sourceContainerWidth: 7, sourcePosition: 0, sourceWidth: 7, destinationContainer: sd2, destinationContainerWidth: 7, destinationPosition: 0, destinationWidth: 7];
FOR i: CARDINAL IN [0 .. 7) DO
IF s1[i] # s2[i] THEN out.PutF["MSTS failed at %g\n", IO.card[i]];
s1[i].val ← IF (i MOD 2) = 0 THEN L ELSE H;
IF s1[6-i].s # [IF (i MOD 2) < 1 THEN drive ELSE charge, IF (i MOD 4) < 2 THEN input ELSE none, IF (i MOD 6) < 3 THEN chargeStrong ELSE driveWeak] THEN out.PutF["ICIS failed at %g\n", IO.card[i]];
ENDLOOP;
IF ECFS[container: sd1, containerWidth: 7, fieldPosition: 1, fieldWidth: 6] # 42 THEN out.PutF["ECFS failed\n"];
out.PutF["Done."];
out.Flush[];
END;
SimpleTest[];
END.