pike.git/
src/
testsuite.in
Branch:
Tag:
Non-build tags
All tags
No tags
1998-10-15
1998-10-15 04:31:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>
1a84bcd1c0c53acc7e6f53abc4c78391ec235911 (
37
lines) (+
36
/-
1
)
[
Show
|
Annotate
]
Branch:
7.9
Added some UTF-8 tests.
Rev: src/testsuite.in:1.127
1:
-
stest_true([["$Id: testsuite.in,v 1.
126
1998/10/
14
05
:
48
:
47
hubbe
Exp $"]])
+
stest_true([["$Id: testsuite.in,v 1.
127
1998/10/
15
04
:
31
:
21
grubba
Exp $"]])
cond([[all_constants()->_verify_internals]], [[ test_do(_verify_internals())
2398:
test_any([[int x=time(); sleep(2); return x!=time()]],1) test_any([[int x=time(); sleep(2); return x!=time()]],1)
+
// - string_to_unicode, string_to_utf8, unicode_to_string, utf8_to_string
+
test_eq(string_to_utf8("foo"), "foo")
+
test_eq(string_to_utf8("blä"), "bl\303\244")
+
test_eq(string_to_utf8("\77077"), "\347\270\277")
+
test_eq(string_to_utf8("\7077077"), "\367\207\270\277")
+
test_eq(string_to_utf8("\77077077", 1), "\370\277\207\270\277")
+
test_eq(string_to_utf8("\7077077077", 1), "\374\270\277\207\270\277")
+
test_eq(string_to_utf8("\77077077077", 1), "\376\203\270\277\207\270\277")
+
test_eq(utf8_to_string("\376\203\270\277\207\270\277"), "\77077077077")
+
test_eq(utf8_to_string("\374\270\277\207\270\277"), "\7077077077")
+
test_eq(utf8_to_string("\370\277\207\270\277"), "\77077077")
+
test_eq(utf8_to_string("\367\207\270\277"), "\7077077")
+
test_eq(utf8_to_string("\347\270\277"), "\77077")
+
test_eq(utf8_to_string("bl\303\244"), "blä")
+
test_eq(utf8_to_string("foo"), "foo")
+
+
test_eval_error(string_to_utf8("\77077077"))
+
test_eval_error(string_to_utf8("\7077077077"))
+
test_eval_error(string_to_utf8("\77077077077"))
+
test_eval_error(utf8_to_string("\277"));
+
test_eval_error(utf8_to_string("\377"));
+
test_eval_error(utf8_to_string("\376\203\270\277\207\270"));
+
test_eval_error(utf8_to_string("\374\270\277\207\270"));
+
test_eval_error(utf8_to_string("\370\277\207\270"));
+
test_eval_error(utf8_to_string("\367\207\270"));
+
test_eval_error(utf8_to_string("\347\270"));
+
test_eval_error(utf8_to_string("\303"));
+
test_eval_error(utf8_to_string("\376\203\270\277\207\270a"));
+
test_eval_error(utf8_to_string("\374\270\277\207\270a"));
+
test_eval_error(utf8_to_string("\370\277\207\270a"));
+
test_eval_error(utf8_to_string("\367\207\270a"));
+
test_eval_error(utf8_to_string("\347\270a"));
+
test_eval_error(utf8_to_string("\303a"));
+
// - sum test_eq(`+(1,1),2) test_eq(`+(1,-2),-1)