summaryrefslogtreecommitdiff
path: root/tests/test
diff options
context:
space:
mode:
authorflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-09-03 20:21:30 +0000
committerflorian <florian@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-09-03 20:21:30 +0000
commit3b846d02e5755e1803ef97406c88ae06f7dc833d (patch)
treec8d1aaaae05d023f6f4bed6c15a3ee427b5ebfbd /tests/test
parent0dce2b3a7f42f397d88c6c94bca19f378a177009 (diff)
downloadfpc-3b846d02e5755e1803ef97406c88ae06f7dc833d.tar.gz
o patch by Michael V. Denisenko to handle case <string> of (see also #13700)
+ compiler implementation + tests git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13642 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'tests/test')
-rw-r--r--tests/test/tcase10.pp25
-rw-r--r--tests/test/tcase11.pp25
-rw-r--r--tests/test/tcase12.pp89
-rw-r--r--tests/test/tcase13.pp68
-rw-r--r--tests/test/tcase14.pp60
-rw-r--r--tests/test/tcase15.pp68
-rw-r--r--tests/test/tcase16.pp68
-rw-r--r--tests/test/tcase17.pp72
-rw-r--r--tests/test/tcase18.pp69
-rw-r--r--tests/test/tcase19.pp70
-rw-r--r--tests/test/tcase20.pp39
-rw-r--r--tests/test/tcase21.pp39
-rw-r--r--tests/test/tcase22.pp64
-rw-r--r--tests/test/tcase23.pp70
-rw-r--r--tests/test/tcase24.pp60
-rw-r--r--tests/test/tcase25.pp60
-rw-r--r--tests/test/tcase26.pp62
-rw-r--r--tests/test/tcase27.pp70
-rw-r--r--tests/test/tcase28.pp89
-rw-r--r--tests/test/tcase29.pp68
-rw-r--r--tests/test/tcase3.pp18
-rw-r--r--tests/test/tcase30.pp60
-rw-r--r--tests/test/tcase31.pp68
-rw-r--r--tests/test/tcase32.pp68
-rw-r--r--tests/test/tcase33.pp72
-rw-r--r--tests/test/tcase34.pp69
-rw-r--r--tests/test/tcase35.pp70
-rw-r--r--tests/test/tcase36.pp39
-rw-r--r--tests/test/tcase37.pp39
-rw-r--r--tests/test/tcase38.pp64
-rw-r--r--tests/test/tcase39.pp70
-rw-r--r--tests/test/tcase4.pp18
-rw-r--r--tests/test/tcase40.pp60
-rw-r--r--tests/test/tcase41.pp60
-rw-r--r--tests/test/tcase42.pp62
-rw-r--r--tests/test/tcase43.pp70
-rw-r--r--tests/test/tcase44.pp131
-rw-r--r--tests/test/tcase45.pp26
-rw-r--r--tests/test/tcase45_2.pp18
-rw-r--r--tests/test/tcase46.pp26
-rw-r--r--tests/test/tcase46_2.pp18
-rw-r--r--tests/test/tcase47.pp26
-rw-r--r--tests/test/tcase47_2.pp18
-rw-r--r--tests/test/tcase48.pp26
-rw-r--r--tests/test/tcase48_2.pp18
-rw-r--r--tests/test/tcase5.pp22
-rw-r--r--tests/test/tcase6.pp25
-rw-r--r--tests/test/tcase7.pp21
-rw-r--r--tests/test/tcase8.pp21
-rw-r--r--tests/test/tcase9.pp23
50 files changed, 2561 insertions, 0 deletions
diff --git a/tests/test/tcase10.pp b/tests/test/tcase10.pp
new file mode 100644
index 0000000000..766cfb9cdf
--- /dev/null
+++ b/tests/test/tcase10.pp
@@ -0,0 +1,25 @@
+{%FAIL}
+
+{ duplicate labels in different cases }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase11.pp b/tests/test/tcase11.pp
new file mode 100644
index 0000000000..088a77e4af
--- /dev/null
+++ b/tests/test/tcase11.pp
@@ -0,0 +1,25 @@
+{%FAIL}
+
+{ duplicate labels in different cases, one of them is range }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase12.pp b/tests/test/tcase12.pp
new file mode 100644
index 0000000000..078565e1e1
--- /dev/null
+++ b/tests/test/tcase12.pp
@@ -0,0 +1,89 @@
+{ 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.
diff --git a/tests/test/tcase13.pp b/tests/test/tcase13.pp
new file mode 100644
index 0000000000..1529faef67
--- /dev/null
+++ b/tests/test/tcase13.pp
@@ -0,0 +1,68 @@
+{ the last range should be converted to single case and give 'expected' value }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: widestring;
+ my_str_ansi: ansistring;
+ my_str_uni: unicodestring;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error_wide ', i);
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error_ansi');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'aa': i := 1;
+ 'ca'..'caa': i := 2;
+ 'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase14.pp b/tests/test/tcase14.pp
new file mode 100644
index 0000000000..a2e7984d43
--- /dev/null
+++ b/tests/test/tcase14.pp
@@ -0,0 +1,60 @@
+{ comparsion with empty string as bound of 'needed' range }
+
+{$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
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase15.pp b/tests/test/tcase15.pp
new file mode 100644
index 0000000000..14b31319c6
--- /dev/null
+++ b/tests/test/tcase15.pp
@@ -0,0 +1,68 @@
+{ comparsion of one-symbol strings as ranges and single cases }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'c';
+ my_str_wide := 'c';
+ my_str_ansi := 'c';
+ my_str_uni := 'c';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase16.pp b/tests/test/tcase16.pp
new file mode 100644
index 0000000000..8f35cd07e6
--- /dev/null
+++ b/tests/test/tcase16.pp
@@ -0,0 +1,68 @@
+{ comparsion of one-symbol strings as ranges and single cases }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'b';
+ my_str_wide := 'b';
+ my_str_ansi := 'b';
+ my_str_uni := 'b';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase17.pp b/tests/test/tcase17.pp
new file mode 100644
index 0000000000..a3c854e9f5
--- /dev/null
+++ b/tests/test/tcase17.pp
@@ -0,0 +1,72 @@
+{ comparsion of empty string }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := '';
+ my_str_wide := '';
+ my_str_ansi := '';
+ my_str_uni := '';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase18.pp b/tests/test/tcase18.pp
new file mode 100644
index 0000000000..70fc0ac973
--- /dev/null
+++ b/tests/test/tcase18.pp
@@ -0,0 +1,69 @@
+{ comparsion of empty string }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: widestring;
+ my_str_ansi: ansistring;
+ my_str_uni: unicodestring;
+ i: integer;
+
+begin
+ my_str := '';
+ my_str_wide := '';
+ my_str_ansi := '';
+ my_str_uni := '';
+ i := -1;
+
+ case my_str of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ case my_str_wide of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ case my_str_ansi of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ case my_str_uni of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase19.pp b/tests/test/tcase19.pp
new file mode 100644
index 0000000000..8e3abb95ce
--- /dev/null
+++ b/tests/test/tcase19.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different cases, one of them is range }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase20.pp b/tests/test/tcase20.pp
new file mode 100644
index 0000000000..dd5b98440f
--- /dev/null
+++ b/tests/test/tcase20.pp
@@ -0,0 +1,39 @@
+{%FAIL}
+
+{ left bound is greater; fails }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ 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'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_wide of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_ansi of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_uni of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase21.pp b/tests/test/tcase21.pp
new file mode 100644
index 0000000000..4d69a67d3c
--- /dev/null
+++ b/tests/test/tcase21.pp
@@ -0,0 +1,39 @@
+{%FAIL}
+
+{ left bound is greater; comparsion with empty string. Fails }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'ababaca';
+ my_str_wide := 'ababaca';
+ my_str_ansi := 'ababaca';
+ my_str_uni := 'ababaca';
+ i := -1;
+
+ case my_str of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_wide of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_ansi of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_uni of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase22.pp b/tests/test/tcase22.pp
new file mode 100644
index 0000000000..9872588b8a
--- /dev/null
+++ b/tests/test/tcase22.pp
@@ -0,0 +1,64 @@
+{ comparsion of one-symbol strings in ranges }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'c';
+ my_str_wide := 'c';
+ my_str_ansi := 'c';
+ my_str_uni := 'c';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase23.pp b/tests/test/tcase23.pp
new file mode 100644
index 0000000000..7e080d54eb
--- /dev/null
+++ b/tests/test/tcase23.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different case ranges }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase24.pp b/tests/test/tcase24.pp
new file mode 100644
index 0000000000..50b0b52506
--- /dev/null
+++ b/tests/test/tcase24.pp
@@ -0,0 +1,60 @@
+{ simple test for range }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase25.pp b/tests/test/tcase25.pp
new file mode 100644
index 0000000000..2af7c9072e
--- /dev/null
+++ b/tests/test/tcase25.pp
@@ -0,0 +1,60 @@
+{ test for range with one-symbol string as left bound }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase26.pp b/tests/test/tcase26.pp
new file mode 100644
index 0000000000..f885e6f069
--- /dev/null
+++ b/tests/test/tcase26.pp
@@ -0,0 +1,62 @@
+{ test for range with one-symbol string as right bound, which is smaller than left. Fail }
+
+{%FAIL}
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase27.pp b/tests/test/tcase27.pp
new file mode 100644
index 0000000000..307433f311
--- /dev/null
+++ b/tests/test/tcase27.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different cases }
+
+{$H+}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase28.pp b/tests/test/tcase28.pp
new file mode 100644
index 0000000000..f14c379251
--- /dev/null
+++ b/tests/test/tcase28.pp
@@ -0,0 +1,89 @@
+{ 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.
diff --git a/tests/test/tcase29.pp b/tests/test/tcase29.pp
new file mode 100644
index 0000000000..f3fd29e0ea
--- /dev/null
+++ b/tests/test/tcase29.pp
@@ -0,0 +1,68 @@
+{ the last range should be converted to single case and give 'expected' value }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: widestring;
+ my_str_ansi: ansistring;
+ my_str_uni: unicodestring;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error_wide ', i);
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'cab'..'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error_ansi');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'aa': i := 1;
+ 'ca'..'caa': i := 2;
+ 'cab': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase3.pp b/tests/test/tcase3.pp
new file mode 100644
index 0000000000..faed506703
--- /dev/null
+++ b/tests/test/tcase3.pp
@@ -0,0 +1,18 @@
+{%FAIL}
+
+{ left bound is greater; fails }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'ababaca';
+ i := -1;
+
+ case my_str of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase30.pp b/tests/test/tcase30.pp
new file mode 100644
index 0000000000..e0248fc334
--- /dev/null
+++ b/tests/test/tcase30.pp
@@ -0,0 +1,60 @@
+{ comparsion with empty string as bound of 'needed' range }
+
+{$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
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ ''..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase31.pp b/tests/test/tcase31.pp
new file mode 100644
index 0000000000..dab14d2018
--- /dev/null
+++ b/tests/test/tcase31.pp
@@ -0,0 +1,68 @@
+{ comparsion of one-symbol strings as ranges and single cases }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'c';
+ my_str_wide := 'c';
+ my_str_ansi := 'c';
+ my_str_uni := 'c';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase32.pp b/tests/test/tcase32.pp
new file mode 100644
index 0000000000..26bf5672bd
--- /dev/null
+++ b/tests/test/tcase32.pp
@@ -0,0 +1,68 @@
+{ comparsion of one-symbol strings as ranges and single cases }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'b';
+ my_str_wide := 'b';
+ my_str_ansi := 'b';
+ my_str_uni := 'b';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase33.pp b/tests/test/tcase33.pp
new file mode 100644
index 0000000000..f801a9d1f2
--- /dev/null
+++ b/tests/test/tcase33.pp
@@ -0,0 +1,72 @@
+{ comparsion of empty string }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := '';
+ my_str_wide := '';
+ my_str_ansi := '';
+ my_str_uni := '';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase34.pp b/tests/test/tcase34.pp
new file mode 100644
index 0000000000..9f7427cfd1
--- /dev/null
+++ b/tests/test/tcase34.pp
@@ -0,0 +1,69 @@
+{ comparsion of empty string }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: widestring;
+ my_str_ansi: ansistring;
+ my_str_uni: unicodestring;
+ i: integer;
+
+begin
+ my_str := '';
+ my_str_wide := '';
+ my_str_ansi := '';
+ my_str_uni := '';
+ i := -1;
+
+ case my_str of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error1');
+ Halt(1);
+ end;
+
+ case my_str_wide of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ case my_str_ansi of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ case my_str_uni of
+ 'b'..'b': i := 1;
+ 'c': i := 2;
+ 'd'..'eee': i := 3;
+ ''..'a': i := 4;
+ else i := 0;
+ end;
+
+ if (i <> 4) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase35.pp b/tests/test/tcase35.pp
new file mode 100644
index 0000000000..e8be55f7d3
--- /dev/null
+++ b/tests/test/tcase35.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different cases, one of them is range }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c'..'d': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase36.pp b/tests/test/tcase36.pp
new file mode 100644
index 0000000000..309a1e0b21
--- /dev/null
+++ b/tests/test/tcase36.pp
@@ -0,0 +1,39 @@
+{%FAIL}
+
+{ left bound is greater; fails }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ 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'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_wide of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_ansi of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_uni of
+ 'abba'..'ababaca': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase37.pp b/tests/test/tcase37.pp
new file mode 100644
index 0000000000..c6e548f921
--- /dev/null
+++ b/tests/test/tcase37.pp
@@ -0,0 +1,39 @@
+{%FAIL}
+
+{ left bound is greater; comparsion with empty string. Fails }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'ababaca';
+ my_str_wide := 'ababaca';
+ my_str_ansi := 'ababaca';
+ my_str_uni := 'ababaca';
+ i := -1;
+
+ case my_str of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_wide of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_ansi of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+
+ case my_str_uni of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase38.pp b/tests/test/tcase38.pp
new file mode 100644
index 0000000000..bdcfa5b491
--- /dev/null
+++ b/tests/test/tcase38.pp
@@ -0,0 +1,64 @@
+{ comparsion of one-symbol strings in ranges }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'c';
+ my_str_wide := 'c';
+ my_str_ansi := 'c';
+ my_str_uni := 'c';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase39.pp b/tests/test/tcase39.pp
new file mode 100644
index 0000000000..3ff3256c76
--- /dev/null
+++ b/tests/test/tcase39.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different case ranges }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase4.pp b/tests/test/tcase4.pp
new file mode 100644
index 0000000000..98ed85fd41
--- /dev/null
+++ b/tests/test/tcase4.pp
@@ -0,0 +1,18 @@
+{%FAIL}
+
+{ left bound is greater; comparsion with empty string. Fails }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'ababaca';
+ i := -1;
+
+ case my_str of
+ 'aba'..'': i := 1;
+ else i := 0;
+ end;
+end.
diff --git a/tests/test/tcase40.pp b/tests/test/tcase40.pp
new file mode 100644
index 0000000000..393fd71a91
--- /dev/null
+++ b/tests/test/tcase40.pp
@@ -0,0 +1,60 @@
+{ simple test for range }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase41.pp b/tests/test/tcase41.pp
new file mode 100644
index 0000000000..c4c0b2ec4d
--- /dev/null
+++ b/tests/test/tcase41.pp
@@ -0,0 +1,60 @@
+{ test for range with one-symbol string as left bound }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase42.pp b/tests/test/tcase42.pp
new file mode 100644
index 0000000000..8797e69b92
--- /dev/null
+++ b/tests/test/tcase42.pp
@@ -0,0 +1,62 @@
+{ test for range with one-symbol string as right bound, which is smaller than left. Fail }
+
+{%FAIL}
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase43.pp b/tests/test/tcase43.pp
new file mode 100644
index 0000000000..9513fef784
--- /dev/null
+++ b/tests/test/tcase43.pp
@@ -0,0 +1,70 @@
+{%FAIL}
+
+{ duplicate labels in different cases }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'b': i := 1;
+ 'c': i := 2;
+ 'c': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase44.pp b/tests/test/tcase44.pp
new file mode 100644
index 0000000000..78a16e6527
--- /dev/null
+++ b/tests/test/tcase44.pp
@@ -0,0 +1,131 @@
+{ test for range with one-symbol string as left bound }
+{ sequence of cases in cases }
+
+{$H-}
+var
+ my_str: string;
+ my_str_wide: string;
+ my_str_ansi: string;
+ my_str_uni: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ my_str_wide := 'cab';
+ my_str_ansi := 'cab';
+ my_str_uni := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'daa':
+ begin
+ case my_str[1] of
+ 'a' : i := 0;
+ 'b' : i := 0;
+ 'c' : i := 1;
+ end;
+ case my_str[2] of
+ 'a' : i := i * 1;
+ 'b' : i := 0;
+ 'c' : i := 0;
+ end;
+ case my_str[3] of
+ 'a' : i := 0;
+ 'b' : i := i * 1;
+ 'c' : i := 0;
+ end;
+ end;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_wide of
+ 'a'..'daa':
+ begin
+ case my_str_wide[1] of
+ 'a' : i := 0;
+ 'b' : i := 0;
+ 'c' : i := 1;
+ end;
+ case my_str_wide[2] of
+ 'a' : i := i * 1;
+ 'b' : i := 0;
+ 'c' : i := 0;
+ end;
+ case my_str_wide[3] of
+ 'a' : i := 0;
+ 'b' : i := i * 1;
+ 'c' : i := 0;
+ end;
+ end;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_ansi of
+ 'a'..'daa':
+ begin
+ case my_str_ansi[1] of
+ 'a' : i := 0;
+ 'b' : i := 0;
+ 'c' : i := 1;
+ end;
+ case my_str_ansi[2] of
+ 'a' : i := i * 1;
+ 'b' : i := 0;
+ 'c' : i := 0;
+ end;
+ case my_str_ansi[3] of
+ 'a' : i := 0;
+ 'b' : i := i * 1;
+ 'c' : i := 0;
+ end;
+ end;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+
+ case my_str_uni of
+ 'a'..'daa':
+ begin
+ case my_str_uni[1] of
+ 'a' : i := 0;
+ 'b' : i := 0;
+ 'c' : i := 1;
+ end;
+ case my_str_uni[2] of
+ 'a' : i := i * 1;
+ 'b' : i := 0;
+ 'c' : i := 0;
+ end;
+ case my_str_uni[3] of
+ 'a' : i := 0;
+ 'b' : i := i * 1;
+ 'c' : i := 0;
+ end;
+ end;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+
+ writeln('OK!');
+end.
diff --git a/tests/test/tcase45.pp b/tests/test/tcase45.pp
new file mode 100644
index 0000000000..7d5ec7ec09
--- /dev/null
+++ b/tests/test/tcase45.pp
@@ -0,0 +1,26 @@
+{ test for complex case-var with H+ dir }
+
+{$H+}
+
+unit tcase45;
+
+interface
+ procedure test_proc(var res : integer); inline;
+
+implementation
+
+var
+ some_str: string;
+
+procedure test_proc(var res : integer);
+begin
+ some_str := 'b';
+ case some_str + 'ababaca' of
+ 'a'..'ba' : res := 1;
+ 'bab'..'bbb' : res := 2;
+ 'bbc'..'bf' : res := 3;
+ else res := 4;
+ end;
+end;
+
+end.
diff --git a/tests/test/tcase45_2.pp b/tests/test/tcase45_2.pp
new file mode 100644
index 0000000000..b5a83feed7
--- /dev/null
+++ b/tests/test/tcase45_2.pp
@@ -0,0 +1,18 @@
+program test_program;
+
+uses
+ tcase45;
+
+var
+ i: integer;
+
+begin
+ test_proc(i);
+ if (i <> 2) then
+ begin
+ writeln('FAIL');
+ halt(1);
+ end
+ else
+ writeln('OK');
+end.
diff --git a/tests/test/tcase46.pp b/tests/test/tcase46.pp
new file mode 100644
index 0000000000..c00f4e5385
--- /dev/null
+++ b/tests/test/tcase46.pp
@@ -0,0 +1,26 @@
+{ test for complex case-var with H- dir }
+
+{$H-}
+
+unit tcase46;
+
+interface
+ procedure test_proc(var res : integer); inline;
+
+implementation
+
+var
+ some_str: string;
+
+procedure test_proc(var res : integer);
+begin
+ some_str := 'b';
+ case some_str + 'ababaca' of
+ 'a'..'ba' : res := 1;
+ 'bab'..'bbb' : res := 2;
+ 'bbc'..'bf' : res := 3;
+ else res := 4;
+ end;
+end;
+
+end.
diff --git a/tests/test/tcase46_2.pp b/tests/test/tcase46_2.pp
new file mode 100644
index 0000000000..2759eed251
--- /dev/null
+++ b/tests/test/tcase46_2.pp
@@ -0,0 +1,18 @@
+program test_program;
+
+uses
+ tcase46;
+
+var
+ i : integer;
+
+begin
+ test_proc(i);
+ if (i <> 2) then
+ begin
+ writeln('FAIL');
+ halt(1);
+ end
+ else
+ writeln('OK');
+end.
diff --git a/tests/test/tcase47.pp b/tests/test/tcase47.pp
new file mode 100644
index 0000000000..e75db1fc3f
--- /dev/null
+++ b/tests/test/tcase47.pp
@@ -0,0 +1,26 @@
+{ test for simple case-var with H- dir }
+
+{$H-}
+
+unit tcase47;
+
+interface
+ procedure test_proc(var res : integer); inline;
+
+implementation
+
+var
+ some_str: string;
+
+procedure test_proc(var res : integer);
+begin
+ some_str := 'b';
+ case some_str of
+ ''..'ba' : res := 1;
+ 'bab'..'bbb' : res := 2;
+ 'bbc'..'bf' : res := 3;
+ else res := 4;
+ end;
+end;
+
+end.
diff --git a/tests/test/tcase47_2.pp b/tests/test/tcase47_2.pp
new file mode 100644
index 0000000000..e2de348794
--- /dev/null
+++ b/tests/test/tcase47_2.pp
@@ -0,0 +1,18 @@
+program test_program;
+
+uses
+ tcase47;
+
+var
+ i : integer;
+
+begin
+ test_proc(i);
+ if (i <> 1) then
+ begin
+ writeln('FAIL');
+ halt(1);
+ end
+ else
+ writeln('OK');
+end.
diff --git a/tests/test/tcase48.pp b/tests/test/tcase48.pp
new file mode 100644
index 0000000000..93ac8085e2
--- /dev/null
+++ b/tests/test/tcase48.pp
@@ -0,0 +1,26 @@
+{ test for simple case-var with H+ dir }
+
+{$H+}
+
+unit tcase48;
+
+interface
+ procedure test_proc(var res : integer); inline;
+
+implementation
+
+var
+ some_str: string;
+
+procedure test_proc(var res : integer);
+begin
+ some_str := 'b';
+ case some_str of
+ ''..'ba' : res := 1;
+ 'bab'..'bbb' : res := 2;
+ 'bbc'..'bf' : res := 3;
+ else res := 4;
+ end;
+end;
+
+end.
diff --git a/tests/test/tcase48_2.pp b/tests/test/tcase48_2.pp
new file mode 100644
index 0000000000..64d6ad99da
--- /dev/null
+++ b/tests/test/tcase48_2.pp
@@ -0,0 +1,18 @@
+program test_program;
+
+uses
+ tcase48;
+
+var
+ i : integer;
+
+begin
+ test_proc(i);
+ if (i <> 1) then
+ begin
+ writeln('FAIL');
+ halt(1);
+ end
+ else
+ writeln('OK');
+end.
diff --git a/tests/test/tcase5.pp b/tests/test/tcase5.pp
new file mode 100644
index 0000000000..9e11f07263
--- /dev/null
+++ b/tests/test/tcase5.pp
@@ -0,0 +1,22 @@
+{ comparsion of one-symbol strings in ranges }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'c';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'d': i := 2;
+ else i := 0;
+ end;
+
+ if (i <> 2) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase6.pp b/tests/test/tcase6.pp
new file mode 100644
index 0000000000..9115af6d5e
--- /dev/null
+++ b/tests/test/tcase6.pp
@@ -0,0 +1,25 @@
+{%FAIL}
+
+{ duplicate labels in different case ranges }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'b': i := 1;
+ 'c'..'caa': i := 2;
+ 'caa'..'cabaa': i := 3;
+ else i := 0;
+ end;
+
+ if (i <> 3) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase7.pp b/tests/test/tcase7.pp
new file mode 100644
index 0000000000..a651f66d70
--- /dev/null
+++ b/tests/test/tcase7.pp
@@ -0,0 +1,21 @@
+{ simple test for range }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'aba'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase8.pp b/tests/test/tcase8.pp
new file mode 100644
index 0000000000..4384c2fac6
--- /dev/null
+++ b/tests/test/tcase8.pp
@@ -0,0 +1,21 @@
+{ test for range with one-symbol string as left bound }
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'a'..'daa': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.
diff --git a/tests/test/tcase9.pp b/tests/test/tcase9.pp
new file mode 100644
index 0000000000..a86293fdea
--- /dev/null
+++ b/tests/test/tcase9.pp
@@ -0,0 +1,23 @@
+{ test for range with one-symbol string as right bound, which is smaller than left. Fail }
+
+{%FAIL}
+
+{$H+}
+var
+ my_str: string;
+ i: integer;
+
+begin
+ my_str := 'cab';
+ i := -1;
+
+ case my_str of
+ 'cab'..'a': i := 1;
+ else i := 0;
+ end;
+
+ if (i <> 1) then begin
+ writeln('Error');
+ Halt(1);
+ end;
+end.