summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw11372.pp
blob: aba55bd3289cbdc010ebbff1bbbd927d230cc090 (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
43
44
45
46
program BoolAsEnumTest_FPC;

{$MODE Delphi}

{$APPTYPE CONSOLE}

uses
  SysUtils,
  TypInfo;

procedure Test_GetEnumName;
begin
  writeln('Testing GetEnumName');
  if TypInfo.GetEnumName(TypeInfo(Boolean),Ord(False))<>'False' then
    halt(1);
  if TypInfo.GetEnumName(TypeInfo(Boolean),Ord(True))<>'True' then
    halt(1);
end;


procedure Test_GetEnumValue;
begin
  writeln('Testing GetEnumValue');
  if TypInfo.GetEnumValue(TypeInfo(Boolean),'false')<>0 then
    halt(1);
  if TypInfo.GetEnumValue(TypeInfo(Boolean),'true')<>1 then
    halt(1);
end;


procedure Test_GetEnumCount;
begin
  writeln('Testing GetEnumCount');
  if TypInfo.GetEnumNameCount(TypeInfo(Boolean))<>Ord(High(Boolean))+1 then
    halt(1);    
end;




begin
  Test_GetEnumCount;
  Test_GetEnumValue;
  Test_GetEnumName;
  writeln('Ok');
end.