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]}

{[show (f () = expected)]}

Client side test: {[testname]}

{[show (f () = expected)]}
}> fun test_fn_sside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody =

Server side test: {[testname]}

{[show (f () = expected)]}
fun test_fn_cside [a ::: Type] (_ : eq a) (_ : show a) (f : unit -> a) (expected : a) (testname : string) : xbody =

Client side test: {[testname]}

{[show (f () = 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 {test_fn_cside (fn _ => strlen "πŒ†πŒ‡πŒˆπŒ‰") (strlen "πŒ†πŒ‡πŒˆπŒ‰") "high encode - strlen 1"} {test_fn_cside (fn _ => strlen "πŒ‡πŒˆπŒ‰") (strlen "πŒ‡πŒˆπŒ‰") "high encode - strlen 2"} {test_fn_cside (fn _ => strlen "πŒˆπŒ‰") (strlen "πŒˆπŒ‰") "high encode - strlen 3"} {test_fn_cside (fn _ => strlen "πŒ‰") (strlen "πŒ‰") "high encode - strlen 4"} {test_fn_cside (fn _ => substring "πŒ†πŒ‡πŒˆπŒ‰" 1 3) (substring "πŒ†πŒ‡πŒˆπŒ‰" 1 3) "high encode - substring 1"} {test_fn_cside (fn _ => substring "πŒ†πŒ‡πŒˆπŒ‰" 2 2) (substring "πŒ†πŒ‡πŒˆπŒ‰" 2 2) "high encode - substring 2"} {test_fn_cside (fn _ => substring "πŒ†πŒ‡πŒˆπŒ‰" 3 1) (substring "πŒ†πŒ‡πŒˆπŒ‰" 3 1) "high encode - substring 3"} {test_fn_cside (fn _ => strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 1 3)) (strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 1 3)) "high encode - strlen of substring 1"} {test_fn_cside (fn _ => strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 2 2)) (strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 2 2)) "high encode - strlen of substring 2"} {test_fn_cside (fn _ => strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 3 1)) (strlen (substring "πŒ†πŒ‡πŒˆπŒ‰" 3 1)) "high encode - strlen of substring 3"} {test_fn_cside (fn _ => strsub "πŒ†πŒ‡πŒˆπŒ‰" 0) (strsub "πŒ†πŒ‡πŒˆπŒ‰" 0) "high encode - strsub 1"} {test_fn_cside (fn _ => strsub "πŒ†πŒ‡πŒˆπŒ‰" 1) (strsub "πŒ†πŒ‡πŒˆπŒ‰" 1) "high encode - strsub 2"} {test_fn_cside (fn _ => strsub "πŒ†πŒ‡πŒˆπŒ‰" 2) (strsub "πŒ†πŒ‡πŒˆπŒ‰" 2) "high encode - strsub 3"} {test_fn_cside (fn _ => strsub "πŒ†πŒ‡πŒˆπŒ‰" 3) (strsub "πŒ†πŒ‡πŒˆπŒ‰" 3) "high encode - strsub 4"} {test_fn_cside (fn _ => strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 0) (strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 0) "high encode - strsuffix 1"} {test_fn_cside (fn _ => strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 1) (strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 1) "high encode - strsuffix 2"} {test_fn_cside (fn _ => strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 2) (strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 2) "high encode - strsuffix 3"} {test_fn_cside (fn _ => strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 3) (strsuffix "πŒ†πŒ‡πŒˆπŒ‰" 3) "high encode - strsuffix 4"} {test_fn_cside (fn _ => strchr "πŒ†πŒ‡πŒˆπŒ‰" #"c") (strchr "πŒ†πŒ‡πŒˆπŒ‰" #"c") "high encode - strchr 1"} {test_fn_cside (fn _ => strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ†" 0)) (strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ†" 0)) "high encode - strchr 2"} {test_fn_cside (fn _ => strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‡" 0)) (strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‡" 0)) "high encode - strchr 3"} {test_fn_cside (fn _ => strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "𝌈" 0)) (strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "𝌈" 0)) "high encode - strchr 4"} {test_fn_cside (fn _ => strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‰" 0)) (strchr "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‰" 0)) "high encode - strchr 5"} {test_fn_cside (fn _ => strindex "πŒ†πŒ‡πŒˆπŒ‰" #"c") (strindex "πŒ†πŒ‡πŒˆπŒ‰" #"c") "high encode - strindex 1"} {test_fn_cside (fn _ => strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ†" 0)) (strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ†" 0)) "high encode - strindex 2"} {test_fn_cside (fn _ => strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‡" 0)) (strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‡" 0)) "high encode - strindex 3"} {test_fn_cside (fn _ => strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "𝌈" 0)) (strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "𝌈" 0)) "high encode - strindex 4"} {test_fn_cside (fn _ => strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‰" 0)) (strindex "πŒ†πŒ‡πŒˆπŒ‰" (strsub "πŒ‰" 0)) "high encode - strindex 5"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "") "high encode - strsindex 1"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆπŒ‰") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆπŒ‰") "high encode - strsindex 2"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆc") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆc") "high encode - strsindex 3"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆπŒ‰") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆπŒ‰") "high encode - strsindex 4"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆc") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆc") "high encode - strsindex 5"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒˆπŒ‰") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒˆπŒ‰") "high encode - strsindex 6"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "𝌈c") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "𝌈c") "high encode - strsindex 7"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‰") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‰") "high encode - strsindex 8"} {test_fn_cside (fn _ => strsindex "πŒ†πŒ‡πŒˆπŒ‰" "c") (strsindex "πŒ†πŒ‡πŒˆπŒ‰" "c") "high encode - strsindex 9"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "") "high encode - strcspn 1"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆπŒ‰") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†πŒ‡πŒˆπŒ‰") "high encode - strcspn 2"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ†") "high encode - strcspn 3"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆπŒ‰") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‡πŒˆπŒ‰") "high encode - strcspn 4"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒˆπŒ‰") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒˆπŒ‰") "high encode - strcspn 5"} {test_fn_cside (fn _ => strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‰") (strcspn "πŒ†πŒ‡πŒˆπŒ‰" "πŒ‰") "high encode - strcspn 6"} {test_fn_cside (fn _ => ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 0)) (ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 0)) "high encode - ord 1"} {test_fn_cside (fn _ => ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 1)) (ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 1)) "high encode - ord 2"} {test_fn_cside (fn _ => ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 2)) (ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 2)) "high encode - ord 3"} {test_fn_cside (fn _ => ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 3)) (ord (strsub "πŒ†πŒ‡πŒˆπŒ‰" 3)) "high encode - ord 4"} {test_fn_cside (fn _ => show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 0)) (show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 0)) "high encode - show 1"} {test_fn_cside (fn _ => show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 1)) (show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 1)) "high encode - show 2"} {test_fn_cside (fn _ => show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 2)) (show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 2)) "high encode - show 3"} {test_fn_cside (fn _ => show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 3)) (show (strsub "πŒ†πŒ‡πŒˆπŒ‰" 3)) "high encode - show 4"} fun substrings () : transaction page = return {test_fn_both_sides (fn _ => substring "abc" 0 3) "abc" "substrings 1"} {test_fn_both_sides (fn _ => substring "abc" 1 2) "bc" "substrings 2"} {test_fn_both_sides (fn _ => substring "abc" 2 1) "c" "substrings 3"} {test_fn_both_sides (fn _ => substring "Γ‘bΓ³" 0 3) "Γ‘bΓ³" "substrings 4"} {test_fn_both_sides (fn _ => substring "Γ‘bΓ³" 1 2) "bΓ³" "substrings 5"} {test_fn_both_sides (fn _ => substring "Γ‘bΓ³" 2 1) "Γ³" "substrings 6"} {test_fn_both_sides (fn _ => substring "Γ‘bΓ³" 0 2) "Γ‘b" "substrings 7"} {test_fn_both_sides (fn _ => substring "Γ‘bΓ³" 0 1) "Γ‘" "substrings 8"} {test_fn_both_sides (fn _ => substring "" 0 0) "" "substrings 9"} fun strlens () : transaction page = return {test_fn_both_sides (fn _ => strlen "abc") 3 "strlen 1"} {test_fn_both_sides (fn _ => strlen "Γ§bc") 3 "strlen 2"} {test_fn_both_sides (fn _ => strlen "çãc") 3 "strlen 3"} {test_fn_both_sides (fn _ => strlen "çãó") 3 "strlen 4"} {test_fn_both_sides (fn _ => strlen "Γ§") 1 "strlen 5"} {test_fn_both_sides (fn _ => strlen "c") 1 "strlen 6"} {test_fn_both_sides (fn _ => strlen "") 0 "strlen 7"} {test_fn_both_sides (fn _ => strlen "が") 1 "strlen 8"} {test_fn_both_sides (fn _ => strlen "ζΌ’") 1 "strlen 9"} {test_fn_both_sides (fn _ => strlen "γ‚«") 1 "strlen 10"} {test_fn_both_sides (fn _ => strlen "وظيفية") 6 "strlen 11"} {test_fn_both_sides (fn _ => strlen "函數") 2 "strlen 12"} {test_fn_both_sides (fn _ => strlen "Π€ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½ΠΎΠ΅") 14 "strlen 13"} fun strlenGens () : transaction page = return {test_fn_both_sides (fn _ => strlenGe "" 1) False "strlenGe 1"} {test_fn_both_sides (fn _ => strlenGe "" 0) True "strlenGe 2"} {test_fn_both_sides (fn _ => strlenGe "aba" 4) False "strlenGe 3"} {test_fn_both_sides (fn _ => strlenGe "aba" 3) True "strlenGe 4"} {test_fn_both_sides (fn _ => strlenGe "aba" 2) True "strlenGe 5"} {test_fn_both_sides (fn _ => strlenGe "àçÑ" 4) False "strlenGe 6"} {test_fn_both_sides (fn _ => strlenGe "àçÑ" 3) True "strlenGe 7"} {test_fn_both_sides (fn _ => strlenGe "àçÑ" 2) True "strlenGe 8"} type clen = { S : string, L : int } val clen_eq : eq clen = mkEq (fn a b => a.S = b.S && a.L = b.L) val clen_show : show clen = mkShow (fn a => "{S = " ^ a.S ^ ", L = " ^ (show a.L) ^ "}") fun strcats () : transaction page = let fun test_cat_and_len n a b expS expL = test_fn_both_sides (fn _ => let val c = strcat a b in {S = c, L = strlen c} end) {S=expS, L=expL} ("strcat " ^ (show n)) in return {test_cat_and_len 1 "" "" "" 0} {test_cat_and_len 2 "aa" "bb" "aabb" 4} {test_cat_and_len 3 "" "bb" "bb" 2} {test_cat_and_len 4 "aa" "" "aa" 2} {test_cat_and_len 5 "Γ Γ " "ÑÑ" "ààÑÑ" 4} {test_cat_and_len 6 "" "ÑÑ" "ÑÑ" 2} {test_cat_and_len 7 "Γ Γ " "" "Γ Γ " 2} {test_cat_and_len 8 "函數" "ãã" "函數ãã" 4} {test_cat_and_len 9 "Γ§" "Γ£" "çã" 2} {test_cat_and_len 10 (show (strsub "Γ§" 0)) (show (strsub "Γ£" 0)) "çã" 2} {test_cat_and_len 11 (show (chr 231)) (show (chr 227)) "çã" 2} end fun strsubs () : transaction page = return {test_fn_both_sides (fn _ => strsub "abΓ Γ§" 0) #"a" "strsub 1"} {test_fn_both_sides (fn _ => strsub "abΓ Γ§" 1) #"b" "strsub 2"} {test_fn_both_sides (fn _ => strsub "Γ b" 0) (strsub "Γ " 0) "strsub 3"} {test_fn_both_sides (fn _ => strsub "abΓ Γ§" 2) (strsub "Γ " 0) "strsub 4"} {test_fn_both_sides (fn _ => strsub "abΓ Γ§" 3) (strsub "Γ§" 0) "strsub 5"} fun strsuffixs () : transaction page = return {test_fn_both_sides (fn _ => strsuffix "abΓ Γ§" 0) "abΓ Γ§" "strsuffix 1"} {test_fn_both_sides (fn _ => strsuffix "abΓ Γ§" 1) "bΓ Γ§" "strsuffix 2"} {test_fn_both_sides (fn _ => strsuffix "abΓ Γ§" 2) "Γ Γ§" "strsuffix 3"} {test_fn_both_sides (fn _ => strsuffix "abΓ Γ§" 3) "Γ§" "strsuffix 4"} fun strchrs () : transaction page = return {test_fn_both_sides (fn _ => strchr "abΓ Γ§" #"c") None "strchr 1"} {test_fn_both_sides (fn _ => strchr "abΓ Γ§" #"a") (Some "abΓ Γ§") "strchr 2"} {test_fn_both_sides (fn _ => strchr "abΓ Γ§" #"b") (Some "bΓ Γ§") "strchr 3"} {test_fn_both_sides (fn _ => strchr "abΓ Γ§" (strsub "Γ " 0)) (Some "Γ Γ§") "strchr 4"} {test_fn_both_sides (fn _ => strchr "abΓ Γ§" (strsub "Γ§" 0)) (Some "Γ§") "strchr 5"} fun strindexs () : transaction page = return {test_fn_both_sides (fn _ => strindex "abΓ Γ§" #"c") None "strindex 1"} {test_fn_both_sides (fn _ => strindex "abΓ Γ§" #"a") (Some 0) "strindex 2"} {test_fn_both_sides (fn _ => strindex "abΓ Γ§" #"b") (Some 1) "strindex 3"} {test_fn_both_sides (fn _ => strindex "abΓ Γ§" (strsub "Γ " 0)) (Some 2) "strindex 4"} {test_fn_both_sides (fn _ => strindex "abΓ Γ§" (strsub "Γ§" 0)) (Some 3) "strindex 5"} fun strsindexs () : transaction page = return {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "") (Some 0) "strsindex 1"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "abΓ Γ§") (Some 0) "strsindex 2"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "abΓ c") None "strsindex 3"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "bΓ Γ§") (Some 1) "strsindex 4"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "bΓ c") None "strsindex 5"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "Γ Γ§") (Some 2) "strsindex 6"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "Γ c") None "strsindex 7"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "Γ§") (Some 3) "strsindex 8"} {test_fn_both_sides (fn _ => strsindex "abΓ Γ§" "c") None "strsindex 9"} fun strcspns () : transaction page = return {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "") 4 "strcspn 1"} {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "abΓ Γ§") 0 "strcspn 2"} {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "a") 0 "strcspn 3"} {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "bΓ Γ§") 1 "strcspn 4"} {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "Γ Γ§") 2 "strcspn 5"} {test_fn_both_sides (fn _ => strcspn "abΓ Γ§" "Γ§") 3 "strcspn 6"} fun str1s () : transaction page = return {test_fn_both_sides (fn _ => str1 #"a") "a" "str1 1"} {test_fn_both_sides (fn _ => str1 (strsub "Γ " 0)) "Γ " "str1 2"} {test_fn_both_sides (fn _ => str1 (strsub "aΓ‘" 1)) "Γ‘" "str1 3"} fun isalnums () : transaction page = return {test_fn_both_sides (fn _ => isalnum #"a") True "isalnum 1"} {test_fn_both_sides (fn _ => isalnum #"a") True "isalnum 2"} {test_fn_both_sides (fn _ => isalnum (strsub "Γ " 0)) True "isalnum 3"} {test_fn_both_sides (fn _ => isalnum #"A") True "isalnum 4"} {test_fn_both_sides (fn _ => isalnum (strsub "Γ€" 0)) True "isalnum 5"} {test_fn_both_sides (fn _ => isalnum #"1") True "isalnum 6"} {test_fn_both_sides (fn _ => not (isalnum #"!")) True "isalnum 7"} {test_fn_both_sides (fn _ => not (isalnum #"#")) True "isalnum 8"} {test_fn_both_sides (fn _ => not (isalnum #" ")) True "isalnum 9"} fun isalphas () : transaction page = return {test_fn_both_sides (fn _ => isalpha #"a") True "isalpha 1"} {test_fn_both_sides (fn _ => isalpha (strsub "Γ " 0)) True "isalpha 2"} {test_fn_both_sides (fn _ => isalpha #"A") True "isalpha 3"} {test_fn_both_sides (fn _ => isalpha (strsub "Γ€" 0)) True "isalpha 4"} {test_fn_both_sides (fn _ => not (isalpha #"1")) True "isalpha 5"} {test_fn_both_sides (fn _ => not (isalpha #"!")) True "isalpha 6"} {test_fn_both_sides (fn _ => not (isalpha #"#")) True "isalpha 7"} {test_fn_both_sides (fn _ => not (isalpha #" ")) True "isalpha 8"} fun isblanks () : transaction page = return {test_fn_both_sides (fn _ => not (isblank #"a")) True "isblank 1"} {test_fn_both_sides (fn _ => not (isblank (strsub "Γ " 0))) True "isblank 2"} {test_fn_both_sides (fn _ => not (isblank #"A")) True "isblank 3"} {test_fn_both_sides (fn _ => not (isblank (strsub "Γ€" 0))) True "isblank 4"} {test_fn_both_sides (fn _ => not (isblank #"1")) True "isblank 5"} {test_fn_both_sides (fn _ => not (isblank #"!")) True "isblank 6"} {test_fn_both_sides (fn _ => not (isblank #"#")) True "isblank 7"} {test_fn_both_sides (fn _ => isblank #" ") True "isblank 8"} {test_fn_both_sides (fn _ => isblank #"\t") True "isblank 9"} {test_fn_both_sides (fn _ => not (isblank #"\n")) True "isblank 10"} fun iscntrls () : transaction page = return {test_fn_sside (fn _ => not (iscntrl #"a")) True "iscntrl 1"} {test_fn_sside (fn _ => not (iscntrl (strsub "Γ " 0))) True "iscntrl 2"} {test_fn_sside (fn _ => not (iscntrl #"A")) True "iscntrl 3"} {test_fn_sside (fn _ => not (iscntrl (strsub "Γ€" 0))) True "iscntrl 4"} {test_fn_sside (fn _ => not (iscntrl #"1")) True "iscntrl 5"} {test_fn_sside (fn _ => not (iscntrl #"!")) True "iscntrl 6"} {test_fn_sside (fn _ => not (iscntrl #"#")) True "iscntrl 7"} {test_fn_sside (fn _ => not (iscntrl #" ")) True "iscntrl 8"} {test_fn_sside (fn _ => iscntrl #"\t") True "iscntrl 9"} {test_fn_sside (fn _ => iscntrl #"\n") True "iscntrl 10"} fun isdigits () : transaction page = return {test_fn_both_sides (fn _ => not (isdigit #"a")) True "isdigit 1"} {test_fn_both_sides (fn _ => not (isdigit (strsub "Γ " 0))) True "isdigit 2"} {test_fn_both_sides (fn _ => not (isdigit #"A")) True "isdigit 3"} {test_fn_both_sides (fn _ => not (isdigit (strsub "Γ€" 0))) True "isdigit 4"} {test_fn_both_sides (fn _ => isdigit #"1") True "isdigit 5"} {test_fn_both_sides (fn _ => not (isdigit #"!")) True "isdigit 6"} {test_fn_both_sides (fn _ => not (isdigit #"#")) True "isdigit 7"} {test_fn_both_sides (fn _ => not (isdigit #" ")) True "isdigit 8"} {test_fn_both_sides (fn _ => not (isdigit #"\t")) True "isdigit 9"} {test_fn_both_sides (fn _ => not (isdigit #"\n")) True "isdigit 10"} fun isgraphs () : transaction page = return {test_fn_sside (fn _ => isgraph #"a") True "isgraph 1"} {test_fn_sside (fn _ => isgraph (strsub "Γ " 0)) True "isgraph 2"} {test_fn_sside (fn _ => isgraph #"A") True "isgraph 3"} {test_fn_sside (fn _ => isgraph (strsub "Γ€" 0)) True "isgraph 4"} {test_fn_sside (fn _ => isgraph #"1") True "isgraph 5"} {test_fn_sside (fn _ => isgraph #"!") True "isgraph 6"} {test_fn_sside (fn _ => isgraph #"#") True "isgraph 7"} {test_fn_sside (fn _ => not (isgraph #" ")) True "isgraph 8"} {test_fn_sside (fn _ => not (isgraph #"\t")) True "isgraph 9"} {test_fn_sside (fn _ => not (isdigit #"\n")) True "isgraph 10"} fun islowers () : transaction page = return {test_fn_both_sides (fn _ => islower #"a") True "islower 1"} {test_fn_both_sides (fn _ => islower (strsub "Γ " 0)) True "islower 2"} {test_fn_both_sides (fn _ => not (islower #"A")) True "islower 3"} {test_fn_both_sides (fn _ => not (islower (strsub "Γ€" 0))) True "islower 4"} {test_fn_both_sides (fn _ => not (islower #"1")) True "islower 5"} {test_fn_both_sides (fn _ => not (islower #"!")) True "islower 6"} {test_fn_both_sides (fn _ => not (islower #"#")) True "islower 7"} {test_fn_both_sides (fn _ => not (islower #" ")) True "islower 8"} {test_fn_both_sides (fn _ => not (islower #"\t")) True "islower 9"} {test_fn_both_sides (fn _ => not (islower #"\n")) True "islower 10"} fun isprints () : transaction page = return {test_fn_both_sides (fn _ => isprint #"a") True "isprint 1"} {test_fn_both_sides (fn _ => isprint (strsub "Γ " 0)) True "isprint 2"} {test_fn_both_sides (fn _ => isprint #"A") True "isprint 3"} {test_fn_both_sides (fn _ => isprint (strsub "Γ€" 0)) True "isprint 4"} {test_fn_both_sides (fn _ => isprint #"1") True "isprint 5"} {test_fn_both_sides (fn _ => isprint #"!") True "isprint 6"} {test_fn_both_sides (fn _ => isprint #"#") True "isprint 7"} {test_fn_both_sides (fn _ => isprint #" ") True "isprint 8"} {test_fn_both_sides (fn _ => not (isprint #"\t")) True "isprint 9"} {test_fn_both_sides (fn _ => not (isprint #"\n")) True "isprint 10"} fun ispuncts () : transaction page = return {test_fn_sside (fn _ => not (ispunct #"a")) True "ispunct 1"} {test_fn_sside (fn _ => not (ispunct (strsub "Γ " 0))) True "ispunct 2"} {test_fn_sside (fn _ => not (ispunct #"A")) True "ispunct 3"} {test_fn_sside (fn _ => not (ispunct (strsub "Γ€" 0))) True "ispunct 4"} {test_fn_sside (fn _ => not (ispunct #"1")) True "ispunct 5"} {test_fn_sside (fn _ => ispunct #"!") True "ispunct 6"} {test_fn_sside (fn _ => ispunct #"#") True "ispunct 7"} {test_fn_sside (fn _ => not (ispunct #" ")) True "ispunct 8"} {test_fn_sside (fn _ => not (isprint #"\t")) True "ispunct 9"} {test_fn_sside (fn _ => not (isprint #"\n")) True "ispunct 10"} fun isspaces () : transaction page = return {test_fn_both_sides (fn _ => not (isspace #"a")) True "isspace 1"} {test_fn_both_sides (fn _ => not (isspace (strsub "Γ " 0))) True "isspace 2"} {test_fn_both_sides (fn _ => not (isspace #"A")) True "isspace 3"} {test_fn_both_sides (fn _ => not (isspace (strsub "Γ€" 0))) True "isspace 4"} {test_fn_both_sides (fn _ => not (isspace #"1")) True "isspace 5"} {test_fn_both_sides (fn _ => not (isspace #"!")) True "isspace 6"} {test_fn_both_sides (fn _ => not (isspace #"#")) True "isspace 7"} {test_fn_both_sides (fn _ => isspace #" ") True "isspace 8"} {test_fn_both_sides (fn _ => isspace #"\t") True "isspace 9"} {test_fn_both_sides (fn _ => isspace #"\n") True "isspace 10"} fun isuppers () : transaction page = return {test_fn_both_sides (fn _ => not (isupper #"a")) True "isupper 1"} {test_fn_both_sides (fn _ => not (isupper (strsub "Γ " 0))) True "isupper 2"} {test_fn_both_sides (fn _ => isupper #"A") True "isupper 3"} {test_fn_both_sides (fn _ => isupper (strsub "Γ€" 0)) True "isupper 4"} {test_fn_both_sides (fn _ => not (isupper #"1")) True "isupper 5"} {test_fn_both_sides (fn _ => not (isupper #"!")) True "isupper 6"} {test_fn_both_sides (fn _ => not (isupper #"#")) True "isupper 7"} {test_fn_both_sides (fn _ => not (isupper #" ")) True "isupper 8"} {test_fn_both_sides (fn _ => not (isupper #"\t")) True "isupper 9"} {test_fn_both_sides (fn _ => not (isupper #"\n")) True "isupper 10"} fun isxdigits () : transaction page = return {test_fn_both_sides (fn _ => isxdigit #"a") True "isxdigit 1"} {test_fn_both_sides (fn _ => not (isxdigit (strsub "Γ " 0))) True "isxdigit 2"} {test_fn_both_sides (fn _ => isxdigit #"A") True "isxdigit 3"} {test_fn_both_sides (fn _ => not (isxdigit (strsub "Γ€" 0))) True "isxdigit 4"} {test_fn_both_sides (fn _ => isxdigit #"1") True "isxdigit 5"} {test_fn_both_sides (fn _ => not (isxdigit #"!")) True "isxdigit 6"} {test_fn_both_sides (fn _ => not (isxdigit #"#")) True "isxdigit 7"} {test_fn_both_sides (fn _ => not (isxdigit #" ")) True "isxdigit 8"} {test_fn_both_sides (fn _ => not (isxdigit #"\t")) True "isxdigit 9"} {test_fn_both_sides (fn _ => not (isxdigit #"\n")) True "isxdigit 10"} fun tolowers () : transaction page = let fun lower_of a _ = tolower a in return {test_fn_both_sides (lower_of #"A") #"a" "tolower 1"} {test_fn_both_sides (lower_of #"a") #"a" "tolower 2"} {test_fn_both_sides (lower_of (strsub "Γ‘" 0)) (strsub "Γ‘" 0) "tolower 3"} {test_fn_both_sides (lower_of (strsub "Á" 0)) (strsub "Γ‘" 0) "tolower 4"} {test_fn_both_sides (lower_of #"1") #"1" "tolower 5"} {test_fn_cside (lower_of (strsub "ß" 0)) (lower_of (strsub "ß" 0) ()) "tolower 6"} end fun touppers () : transaction page = let fun upper_of a _ = toupper a in return {test_fn_both_sides (upper_of #"A") #"A" "toupper 1"} {test_fn_both_sides (upper_of #"a") #"A" "toupper 2"} {test_fn_both_sides (upper_of (strsub "Γ‘" 0)) (strsub "Á" 0) "toupper 3"} {test_fn_both_sides (upper_of (strsub "Á" 0)) (strsub "Á" 0) "toupper 4"} {test_fn_both_sides (upper_of #"1") #"1" "toupper 5"} {test_fn_cside (upper_of (strsub "ß" 0)) (upper_of (strsub "ß" 0) ()) "toupper 6"} end fun ord_and_chrs () : transaction page = return {test_fn_both_sides (fn _ => chr (ord #"A")) #"A" "ord => chr 1"} {test_fn_both_sides (fn _ => chr (ord #"a")) #"a" "ord => chr 2"} {test_fn_both_sides (fn _ => chr (ord (strsub "Γ‘" 0))) (strsub "Γ‘" 0) "ord => chr 3"} {test_fn_both_sides (fn _ => chr (ord (strsub "Á" 0))) (strsub "Á" 0) "ord => chr 4"} {test_fn_both_sides (fn _ => chr (ord #"1")) #"1" "ord => chr 5"} {test_fn_both_sides (fn _ => chr (ord #"\n")) #"\n" "ord => chr 6"} {test_fn_both_sides (fn _ => chr (ord (strsub "が" 0))) (strsub "が" 0) "ord => chr 7"} {test_fn_both_sides (fn _ => chr (ord (strsub "ζΌ’" 0))) (strsub "ζΌ’" 0) "ord => chr 8"} {test_fn_both_sides (fn _ => chr (ord (strsub "γ‚«" 0))) (strsub "γ‚«" 0) "ord => chr 9"} fun test_ords () : transaction page = let fun ord_of c _ = ord c in return {test_fn_cside (ord_of (strsub "a" 0)) (ord_of (strsub "a" 0) ()) "test ord 1"} {test_fn_cside (ord_of (strsub "Γ‘" 0)) (ord_of (strsub "Γ‘" 0) ()) "test ord 2"} {test_fn_cside (ord_of (strsub "5" 0)) (ord_of (strsub "5" 0) ()) "test ord 3"} {test_fn_cside (ord_of (strsub "が" 0)) (ord_of (strsub "が" 0) ()) "test ord 4"} {test_fn_cside (ord_of (strsub "ζΌ’" 0)) (ord_of (strsub "ζΌ’" 0) ()) "test ord 5"} {test_fn_cside (ord_of (strsub "γ‚«" 0)) (ord_of (strsub "γ‚«" 0) ()) "test ord 6"} end table t : { Id : int, Text : string } fun test_db () : transaction page = let val s1 = "abc" val s2 = "çãó" val s3 = "が" val s4 = "ζΌ’" val s5 = "γ‚«" val s6 = "وظيفية" fun test_str_and_len n c expS expL = test_fn_both_sides (fn _ => {S = c, L = strlen c}) {S=expS, L=expL} ("test_db " ^ (show n)) in dml (INSERT INTO t (Id, Text) VALUES({[1]}, {[s1]})); t1 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 1); dml (INSERT INTO t (Id, Text) VALUES({[2]}, {[s2]})); t2 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 2); dml (INSERT INTO t (Id, Text) VALUES({[3]}, {[s3]})); t3 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 3); dml (INSERT INTO t (Id, Text) VALUES({[4]}, {[s4]})); t4 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 4); dml (INSERT INTO t (Id, Text) VALUES({[5]}, {[s5]})); t5 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 5); dml (INSERT INTO t (Id, Text) VALUES({[6]}, {[s6]})); t6 <- oneRow (SELECT t.Text FROM t WHERE t.Id = 6); return {test_str_and_len 1 t1.T.Text s1 (strlen s1)} {test_str_and_len 2 t2.T.Text s2 (strlen s2)} {test_str_and_len 3 t3.T.Text s3 (strlen s3)} {test_str_and_len 4 t4.T.Text s4 (strlen s4)} {test_str_and_len 5 t5.T.Text s5 (strlen s5)} {test_str_and_len 6 t6.T.Text s6 (strlen s6)} 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 substrings strlens strlenGens strcats strsubs strsuffixs strchrs strindexs strsindexs strcspns str1s isalnums isalphas isblanks iscntrls isdigits isgraphs islowers isprints ispuncts isspaces isuppers isxdigits tolowers touppers ord_and_chrs test ord highencode test_db