2017-01-15 21:28:14 +00:00
|
|
|
#
|
|
|
|
(*$U+ -- enables underscores in identifiers *)
|
|
|
|
|
2017-01-15 21:33:41 +00:00
|
|
|
program pascalsets;
|
2017-01-15 21:28:14 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
charset = set of char;
|
|
|
|
|
|
|
|
var
|
|
|
|
s : charset;
|
|
|
|
i : integer;
|
|
|
|
|
|
|
|
procedure finished;
|
|
|
|
extern;
|
|
|
|
|
|
|
|
procedure fail(line: integer);
|
|
|
|
extern;
|
|
|
|
|
|
|
|
#define ASSERT(cond) \
|
|
|
|
if (not (cond)) then fail(__LINE__)
|
|
|
|
|
|
|
|
begin
|
|
|
|
s := [];
|
|
|
|
for i := 0 to 255 do
|
|
|
|
s := s + [chr(i)];
|
|
|
|
|
2017-01-17 21:31:38 +00:00
|
|
|
i := 99; (* to defeat optimisation *)
|
|
|
|
ASSERT(chr(42) in s);
|
|
|
|
ASSERT(chr(142) in s);
|
|
|
|
ASSERT(chr(i) in s);
|
|
|
|
s := s - [chr(42)];
|
|
|
|
ASSERT(not(chr(42) in s));
|
|
|
|
ASSERT(chr(142) in s);
|
|
|
|
ASSERT(chr(i) in s);
|
|
|
|
|
2017-01-15 21:28:14 +00:00
|
|
|
finished
|
|
|
|
end.
|