TestTestSubject: CEDAR PROGRAM IMPORTS Commander, FS, IO, KipperSupport, Rope, TestSubject =
CompareW2: PROC[old, new: REF TestSubject.W2] =
BEGIN
IF old.cardinal # new.cardinal THEN ERROR;
IF old.int # new.int THEN ERROR;
IF old.boolean # new.boolean THEN ERROR;
IF NOT Rope.Equal[old.rope, new.rope] THEN ERROR;
IF old.bool # new.bool THEN ERROR;
IF old.char # new.char THEN ERROR;
IF old.character # new.character THEN ERROR;
IF old.integer # new.integer THEN ERROR;
IF old.nat # new.nat THEN ERROR;
IF old.real # new.real THEN ERROR;
IF old.word # new.word THEN ERROR;
IF old.card # new.card THEN ERROR;
END;
Test: Commander.CommandProc = TRUSTED
BEGIN
chain: TestSubject.A ← NIL;
s: IO.STREAM ← FS.StreamOpen["testFile", create];
m: KipperSupport.Kipperer ← KipperSupport.CreateKipperer[s];
t: IO.STREAM;
um: KipperSupport.UnKipperer;
newChain: TestSubject.A ← NIL;
list: TestSubject.s ← NIL;
newList: TestSubject.s ← NIL;
listList: TestSubject.B ← NIL;
newListList: TestSubject.B ← NIL;
x1: TestSubject.X1;
newX1: TestSubject.X1;
z1: TestSubject.Z1;
newz1: TestSubject.Z1;
w11: REF TestSubject.W1;
w12: REF TestSubject.W1;
rope1, rope2, rope3: Rope.ROPE;
newRope1, newRope2, newRope3: Rope.ROPE;
FOR I: CARDINAL IN [0..100) DO
chain ← NEW[TestSubject.ABody←[I, 2*I, NIL, chain]];
IF chain.next # NIL THEN chain.next.prev ← chain;
ENDLOOP;
FOR I: CARDINAL IN [0..1000) DO
list ← CONS[I, list];
ENDLOOP;
listList ← LIST[LIST[b, c, c], LIST[a, b, b, b], LIST[a]];
x1 ← NEW[Rope.ROPE ← "This is a long rope, designed to exceed the text buffer size in the marshall code by a few characters."];
w11 ← NEW[TestSubject.W1[5] ← [27, FALSE, ]];
w11.s[0] ← NIL;
w11.s[1] ← NEW[TestSubject.ItemBody←[45, 67]];
w11.s[2] ← NEW[TestSubject.ItemBody←[34, 4]];
w11.s[3] ← NEW[TestSubject.ItemBody←[5, 345]];
w11.s[4] ← NEW[TestSubject.ItemBody←[198, -9]];
w12 ← NEW[TestSubject.W1[1] ← [34, TRUE, ]];
w12.s[0] ← NEW[TestSubject.ItemBody←[45, 5678]];
z1 ← LIST[listList, NIL, "xxy", w11, w12, NEW[TestSubject.W2←[9, -9, FALSE, "xx", TRUE, 'x, 'y, LAST[INTEGER], LAST[NAT], 4.56, 56B, 32345670123B]]];
rope1 ← "abcdefg";
rope2 ← rope1; -- designed so that rope1 EQ rope2
rope3 ← Rope.Substr["abcdefgh", 0, 7]; -- not an EQ, but an EQUAL
TestSubject.KipperA[m, chain];
TestSubject.Kippers[m, list];
TestSubject.KipperB[m, listList];
TestSubject.KipperX1[m, x1];
TestSubject.KipperZ1[m, z1];
KipperSupport.KipperRope[m, rope1];
KipperSupport.KipperRope[m, rope2];
KipperSupport.KipperRope[m, rope3];
IO.Close[s];
t ← FS.StreamOpen["testFile"];
um ← KipperSupport.CreateUnKipperer[t];
newChain ← TestSubject.UnKipperA[um];
newList ← TestSubject.UnKippers[um];
newListList ← TestSubject.UnKipperB[um];
newX1 ← TestSubject.UnKipperX1[um];
newz1 ← TestSubject.UnKipperZ1[um];
newRope1 ← KipperSupport.UnKipperRope[um];
newRope2 ← KipperSupport.UnKipperRope[um];
newRope3 ← KipperSupport.UnKipperRope[um];
IO.Close[t];
END..