Debian Codegraph @

reports/st/st_string_UTF-8.li

raw
1 /*
2 * @progname st_string_UTF-8.li
3 * @version 1.1
4 * @author Perry Rapp
5 * @category self-test
6 * @output none
7 * @description validate string functions on UTF-8
8 */
9
10 char_encoding("UTF-8")
11
12 require("lifelines-reports.version:1.3")
13 option("explicitvars") /* Disallow use of undefined variables */
14 include("st_aux")
15
16 /* entry point in case not invoked via st_all.ll */
17 proc main()
18 {
19 call testStrings_UTF_8()
20 }
21
22 /*
23 test some string functions against defined & undefined strings
24 */
25 proc testStrings_UTF_8()
26 {
27 call initSubsection()
28
29 call testBothWays_UTF_8("ä", "Ä", "adia") /* u+00E4, u+00C4 */
30 call testBothWays_UTF_8("ö", "Ö", "odia") /* u+00F6, u+00D6 */
31 call testBothWays_UTF_8("æ", "Æ", "ae") /* u+00E6, u+00C6 */
32 call testBothWays_UTF_8("ǽ", "Ǽ", "ae_acute") /* u+01FD, u+01FC */
33 call testBothWays_UTF_8("ð", "Ð", "eth") /* u+00F0, u+00D0 */
34 call testBothWays_UTF_8("þ", "Þ", "thorn") /* u+00FE, u+00DE */
35 call testBothWays_UTF_8("ø", "Ø", "o_stroke") /* u+00F8, u+00D8 */
36 call testBothWays_UTF_8("œ", "Œ", "oe") /* u+0153, u+0152 */
37 call testBothWays_UTF_8("ł", "Ł", "l_stroke") /* u+0142, u+0141 */
38 call testBothWays_UTF_8("δ", "Δ", "delta") /* u+03B4, u+0394 */
39 call testBothWays_UTF_8("ш", "Ш", "Cyrillic_sha") /* u+0448, u+0428 */
40
41 /* special cases */
42 /*
43 Special handling of Greek lower sigma is not implemented
44 Currently lifelines uses Unicode character properties
45 from UnicodeDataExcerpt.txt
46 */
47 /* call testBothWays_UTF_8("σας", "ΣΑΣ", "Greek sas") */
48
49 /* TODO: add German special case when implemented */
50
51 call reportSubsection("string UTF-8 tests")
52 }
53
54 proc testBothWays_UTF_8(slo, shi, sname)
55 {
56 if (ne(upper(slo), shi)) {
57 call reportfail(concat("upper(", sname, ") FAILED"))
58 }
59 else { incr(testok) }
60
61 if (ne(lower(shi), slo)) {
62 call reportfail(concat("lower(", sname, ") FAILED"))
63 }
64 else { incr(testok) }
65 }