diff --git a/src/testsuite.in b/src/testsuite.in index 27e6e04a22fdac43288480c96deef4db8b441877..56ac1749a48c2e73154cd69e1b08dbfe36c02469 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -1,4 +1,4 @@ -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,6 +2398,40 @@ test_do(sleep(0.5)) 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)