fpc/tests/test/tcase28.pp
florian cf215d5097 o patch by Michael V. Denisenko to handle case <string> of (see also #13700)
+ compiler implementation
  + tests

git-svn-id: trunk@13642 -
2009-09-03 20:21:30 +00:00

90 lines
1.4 KiB
ObjectPascal

{ test for simple comparsion }
{$H-}
var
my_str: string;
my_str_wide: widestring;
my_str_ansi: ansistring;
my_str_uni: unicodestring;
i: integer;
begin
my_str := 'ababaca';
my_str_wide := 'ababaca';
my_str_ansi := 'ababaca';
my_str_uni := 'ababaca';
i := -1;
case my_str of
'abba': i := 1;
'ababac': i := 2;
'ababacaa': i := 3;
'ababaca ': i := 4;
' ababaca': i := 5;
' ababac': i := 6;
'ababaca': i := 7;
else i := 0;
end;
writeln(i);
if (i <> 7) then begin
writeln('Error');
Halt(1);
end;
case my_str_wide of
'abba': i := 1;
'ababac': i := 2;
'ababacaa': i := 3;
'ababaca ': i := 4;
' ababaca': i := 5;
' ababac': i := 6;
'ababaca': i := 7;
else i := 0;
end;
writeln(i);
if (i <> 7) then begin
writeln('Error');
Halt(1);
end;
case my_str_ansi of
'abba': i := 1;
'ababac': i := 2;
'ababacaa': i := 3;
'ababaca ': i := 4;
' ababaca': i := 5;
' ababac': i := 6;
'ababaca': i := 7;
else i := 0;
end;
writeln(i);
if (i <> 7) then begin
writeln('Error');
Halt(1);
end;
case my_str_uni of
'abba': i := 1;
'ababac': i := 2;
'ababacaa': i := 3;
'ababaca ': i := 4;
' ababaca': i := 5;
' ababac': i := 6;
'ababaca': i := 7;
else i := 0;
end;
writeln(i);
if (i <> 7) then begin
writeln('Error');
Halt(1);
end;
end.