forked from pascalabcnet/pascalabcnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharrays6.pas
114 lines (106 loc) · 3.14 KB
/
arrays6.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
procedure Test;
var b1 : set of byte := [-1..3];
b2 : array[1..5] of integer := (1,2,3,4,5);
b3 : array of real := (2.4,3.5,1.2);
b4 : array[1..3] of set of char := (['a','j'],['l','b','c'],[]);
begin
var a1 : set of byte := [-1..3];
assert(a1=[0..3]);
assert(2 in a1);
var a2 : array[1..5] of integer := (1,2,3,4,5);
assert(a2[3] = 3);
var a3 : array of real := (2.4,3.5,1.2);
assert(a3[1] = 3.5);
var a4 : array[1..3,1..2] of integer := ((1,2),(2,3),(3,4));
assert(a4[2,2] = 3);
var a5 : array[0..2] of set of char := (['a','j'],['l','b','c'],[]);
assert(a5[0] = ['a','j']);
assert(a5[2]=[]);
assert(b1 = [0..3]);
assert(1 in b1);
assert(b2[2] = 2);
assert(b3[2] = 1.2);
assert(b4[1] = ['a','j']);
Include(b1,4); assert(b1=[0..4]);
Exclude(b1,4); assert(b1=[0..3]);
assert(2 in b1);
end;
procedure Test2;
var b1 : set of byte := [-1..3];
b2 : array[1..5] of integer := (1,2,3,4,5);
b3 : array of real := (2.4,3.5,1.2);
b4 : array[1..3] of set of char := (['a','j'],['l','b','c'],[]);
procedure Nested;
begin
var a1 : set of byte := [-1..3];
assert(a1=[0..3]);
assert(2 in a1);
var a2 : array[1..5] of integer := (1,2,3,4,5);
assert(a2[3] = 3);
var a3 : array of real := (2.4,3.5,1.2);
assert(a3[1] = 3.5);
var a4 : array[1..3,1..2] of integer := ((1,2),(2,3),(3,4));
assert(a4[2,2] = 3);
var a5 : array[0..2] of set of char := (['a','j'],['l','b','c'],[]);
assert(a5[0] = ['a','j']);
assert(a5[2]=[]);
assert(b1 = [0..3]);
assert(1 in b1);
assert(b2[2] = 2);
assert(b3[2] = 1.2);
assert(b4[1] = ['a','j']);
Include(b1,4); assert(b1=[0..4]);
Exclude(b1,4); assert(b1=[0..3]);
assert(2 in b1);
end;
begin
var a1 : set of byte := [-1..3];
assert(a1=[0..3]);
assert(2 in a1);
var a2 : array[1..5] of integer := (1,2,3,4,5);
assert(a2[3] = 3);
var a3 : array of real := (2.4,3.5,1.2);
assert(a3[1] = 3.5);
var a4 : array[1..3,1..2] of integer := ((1,2),(2,3),(3,4));
assert(a4[2,2] = 3);
var a5 : array[0..2] of set of char := (['a','j'],['l','b','c'],[]);
assert(a5[0] = ['a','j']);
assert(a5[2]=[]);
assert(b1 = [0..3]);
assert(1 in b1);
assert(b2[2] = 2);
assert(b3[2] = 1.2);
assert(b4[1] = ['a','j']);
Include(b1,4); assert(b1=[0..4]);
Exclude(b1,4); assert(b1=[0..3]);
assert(2 in b1);
Nested;
end;
var b1 : set of byte := [-1..3];
b2 : array[1..5] of integer := (1,2,3,4,5);
b3 : array of real := (2.4,3.5,1.2);
b4 : array[1..3] of set of char := (['a','j'],['l','b','c'],[]);
begin
var a5 : array[0..2] of set of char := (['a','j'],['l','b','c'],[]);
assert(a5[0] = ['a','j']);
assert(a5[2]=[]);
var a1 : set of byte := [-1..3];
assert(a1=[0..3]);
assert(2 in a1);
var a2 : array[1..5] of integer := (1,2,3,4,5);
assert(a2[3] = 3);
var a3 : array of real := (2.4,3.5,1.2);
assert(a3[1] = 3.5);
var a4 : array[1..3,1..2] of integer := ((1,2),(2,3),(3,4));
assert(a4[2,2] = 3);
assert(b1 = [0..3]);
assert(1 in b1);
assert(b2[2] = 2);
assert(b3[2] = 1.2);
assert(b4[1] = ['a','j']);
Include(b1,4); assert(b1=[0..4]);
Exclude(b1,4); assert(b1=[0..3]);
assert(2 in b1);
Test;
Test2;
end.