|
|
1.1 root 1: {TEST 6.6.5.4-1, CLASS=CONFORMANCE}
2:
3: { This program tests that pack and unpack are
4: implemented in this compiler as according to the
5: Standard.
6: The compiler fails if the program does not compile. }
7:
8: program t6p6p5p4d1(output);
9: type
10: colourtype = (red,pink,orange,yellow,green,blue);
11: var
12: unone : array[3..24] of char;
13: pacone : packed array[1..4] of char;
14: untwo : array[4..8] of colourtype;
15: pactwo : packed array[6..7] of colourtype;
16: i : integer;
17: colour : colourtype;
18: begin
19: pacone:='ABCD';
20: unpack(pacone,unone,5);
21: colour:=red;
22: for i:=4 to 8 do
23: begin
24: untwo[i]:=colour;
25: colour:=succ(colour)
26: end;
27: pack(untwo,5,pactwo);
28: writeln('unone[5] = ''', unone[5], ''' = ', ord(unone[5]));
29: if unone[5]='A' then
30: writeln(' PASS...6.6.5.4-1')
31: else
32: writeln(' FAIL...6.6.5.4-1')
33: end.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.