From e452bb052b6c1afbaaa72efb653ea31561333866 Mon Sep 17 00:00:00 2001 From: fab Date: Tue, 11 Dec 2018 22:16:37 +0000 Subject: exhaustive testing brought to selenium. bug fix in isspace. useful function to test if char is <128 --- tests/utf8.ur | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 217 insertions(+) (limited to 'tests/utf8.ur') diff --git a/tests/utf8.ur b/tests/utf8.ur index c7aefd79..777bb141 100644 --- a/tests/utf8.ur +++ b/tests/utf8.ur @@ -1,4 +1,13 @@ +fun from_m_upto_n f m n = + if m < n then + + { f m } + { from_m_upto_n f (m + 1) n } + + else + + fun test_fn_both_sides [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody =

Server side test: {[testname]}

@@ -31,6 +40,38 @@ fun test_fn_cside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected
+ +fun test_fn_cside_ch (f : unit -> char) (expected : char) (testname : string) : xbody = + + + else + return

ERROR {[testname]}: {[msgErr]}

+ end}> + + + +fun test_fn_cside_b (f : unit -> bool) (expected : bool) (testname : string) : xbody = + + + else + return

ERROR {[testname]}: {[msgErr]}

+ end}> + + + + fun highencode () : transaction page = return @@ -553,6 +594,182 @@ fun test_db () : transaction page = end +and ftTolower (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_ch (fn _ => tolower (chr n)) (tolower (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftToupper (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_ch (fn _ => toupper (chr n)) (toupper (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsalpha (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isalpha (chr n)) (isalpha (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsdigit (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isdigit (chr n)) (isdigit (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsalnum (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isalnum (chr n)) (isalnum (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsspace (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isspace (chr n)) (isspace (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsblank (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isblank (chr n)) (isblank (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsprint (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isprint (chr n)) (isprint (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsxdigit (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isxdigit (chr n)) (isxdigit (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIsupper (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => isupper (chr n)) (isupper (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + +and ftIslower (minCh : int) (maxCh : int) : transaction page = + let + fun test_chr (n : int) : xbody = + if iscodepoint n then + test_fn_cside_b (fn _ => islower (chr n)) (islower (chr n)) + ("test chr " ^ (show n) ^ " : " ^ (show (chr n))) + else + + in + return + + { from_m_upto_n (fn n => test_chr n) minCh maxCh } + + + end + fun index () : transaction page = return -- cgit v1.2.3