Debian Codegraph @

reports/st/st_collate.li

raw
1 /*
2 * @progname st_collate.li
3 * @version 1.0
4 * @author Perry Rapp
5 * @category self-test
6 * @output none
7 * @description
8 *
9 * validate collation
10 *
11 */
12
13 char_encoding("ASCII")
14
15 require("lifelines-reports.version:1.3")
16 option("explicitvars") /* Disallow use of undefined variables */
17 include("st_aux")
18 include("st_collate_UTF-8")
19 include("st_collate_8859-1")
20
21 /* entry point in case not invoked via st_all.ll */
22 proc main()
23 {
24 call testCollate()
25 }
26
27 proc testCollate()
28 {
29 call initSubsection()
30 call testCollate_UTF_8()
31 call testCollate_8859_1()
32 call reportSubsection("collate tests")
33 }
34
35 proc check_collate2(str1, str2)
36 {
37 if (ge(strcmp(str1,str2),0)) {
38 /* str1 might be of the form string:[name] */
39 set(str1nam, str1)
40 set(i1, index(str1, ":", 1))
41 if (gt(i1,0)) {
42 set(str1nam, substring(str1, add(i1,1), strlen(str1)))
43 set(str1, substring(str1, 1, sub(i1,1)))
44 }
45 /* str2 might be of the form string:[name] */
46 set(str2nam, str2)
47 set(i2, index(str2, ":", 1))
48 if (gt(i2,0)) {
49 set(str2nam, substring(str2, add(i2,1), strlen(str2)))
50 set(str2, substring(str2, 1, sub(i2,1)))
51 }
52 set(fstr, concat("strcmp(", str1nam,",",str2nam,") FAILED"))
53 call reportfail(fstr)
54 } else { incr(testok) }
55 }
56 proc check_collate3(str1, str2, str3)
57 {
58 call check_collate2(str1, str2)
59 call check_collate2(str2, str3)
60 }
61
62 proc set_section(name)
63 {
64 set(section, name)
65 }
66