summaryrefslogtreecommitdiff
path: root/tests/tbs/tb0642.pp
blob: 501795205c4ca799618a5c600ec4d650760e7cab (plain)
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
program tb0642;
{$mode objfpc}
{$h+}

type
  TResult = (
    resFirst,
    resSecond,
    resElse
  );

function Test(const aStr: String): TResult;
begin
  case aStr of
    'Hello', 'Hello2': Exit(resFirst);
    'a'..'z': Exit(resSecond);
    else
      Exit(resElse);
  end;
end;

begin
  if Test('Hello') <> resFirst then
    Halt(1);
  if Test('Hello2') <> resFirst then
    Halt(2);
  if Test('a') <> resSecond then
    Halt(3);
  if Test('z') <> resSecond then
    Halt(4);
  if Test('g') <> resSecond then
    Halt(5);
  if Test('alpha') <> resSecond then
    Halt(6);
  if Test('zeta') <> resElse then
    Halt(7);
  if Test('A') <> resElse then
    Halt(8);
  if Test('1') <> resElse then
    Halt(9);
  Writeln('ok');
end.