summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw16848.pp
blob: f19ce0321b2e3d41db3b9241029380212cfdf7df (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
47
48
49
50
51
{$ifdef fpc}
{$mode objfpc}{$H+}
{$endif}
uses
  Classes, SysUtils;

var
  B: Boolean;
  S: String;
begin
  WriteLn('BoolToStr(False, True): ' + BoolToStr(False, True));
  if BoolToStr(False, True)<>'False' then
    halt(1);
  WriteLn('BoolToStr(True, True): ' + BoolToStr(True, True));
  if BoolToStr(True, True)<>'True' then
    halt(2);

  SetLength(TrueBoolStrs, 1);
  SetLength(FalseBoolStrs, 1);
  TrueBoolStrs[0] := 'Sim';
  FalseBoolStrs[0] := 'Não';

  WriteLn('BoolStrs = Não;Sim');

  WriteLn('BoolToStr(False, True): ' + BoolToStr(False, True));
  WriteLn('BoolToStr(True, True): ' + BoolToStr(True, True));

  S := BoolToStr(False, True);
  if S<>'Não' then
    halt(3);
  B := StrToBool(S);
  if b<>false then
    halt(4);

  WriteLn('StrToBool(' + S +') = ' + BoolToStr(B, True));
  if BoolToStr(B, True)<>'Não' then
    halt(5);
  S := BoolToStr(True, True);
  if s<>'Sim' then
    halt(6);
  B := StrToBool(S);
  if b<>true then
    halt(7);
  WriteLn('StrToBool(' + S +') = ' + BoolToStr(B, True));
  if BoolToStr(B, True)<>'Sim' then
    halt(8);

  { should give exception }
  if TryStrToBool('True',B) then
    halt(9);
end.