1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
|
# 26may22 Software Lab. Alexander Burger
### locale ###
(locale "DE" "de")
(test "Ja" (val ,"Yes"))
(locale)
### align ###
(test " a" (align 4 'a))
(test " a" (align 4 "a"))
(test "12 " (align -4 12))
(test " a 12 b" (align (4 4 4) "a" 12 "b"))
### center ###
(test " 12" (center 4 12))
(test " a" (center 4 "a"))
(test " a" (center 7 'a))
(test " a b c" (center (3 3 3) "a" "b" "c"))
### wrap ###
(test "The quick brown fox\njumps over the lazy\ndog"
(wrap 20 (chop "The quick brown fox jumps over the lazy dog")) )
(test "The\nquick\nbrown\nfox\njumps\nover the\nlazy dog"
(wrap 8 (chop "The quick brown fox jumps over the lazy dog")) )
(test "The\nquick\nbrown\nfox\njumps\nover\nthe\nlazy\ndog"
(wrap 2 (chop "The quick brown fox jumps over the lazy dog")) )
(test '("The" "quick" "brown" "fox" "jumps" "over the" "lazy dog")
(wrap 8 "The quick brown fox jumps over the lazy dog") )
### pad ###
(test "00001" (pad 5 1))
(test "123456789" (pad 5 123456789))
### bin ###
(test "1001001" (bin (+ 64 8 1)))
(test (+ 64 8 1) (bin "1001001"))
(test "-110110" (bin -54))
(test -54 (bin "-110110"))
### oct ###
(test "111" (oct (+ 64 8 1)))
(test (+ 64 8 1) (oct "111"))
(test "-66" (oct -54))
(test -54 (oct "-66"))
### hex ###
(test "111" (hex (+ 256 16 1)))
(test (+ 256 16 1) (hex "111"))
(test "-FFFF" (hex -65535))
### money ###
(test "1,234,567.89" (money 123456789))
(test "1,234,567.89 EUR" (money 123456789 "EUR"))
(locale "DE" "de")
(test "1.234.567,89 EUR" (money 123456789 "EUR"))
(locale)
### round ###
(scl 4)
(test "12.35" (round 123456 2))
(test "12.3456" (round 123456 6))
(test "12.346" (round 123456))
### balance ###
(test (5 (2 (1) 3 NIL 4) 7 (6) 8 NIL 9)
(let I NIL (balance 'I (sort (1 4 2 5 3 6 7 9 8))) I) )
### *Allow allowed allow ###
(allowed ("app/")
"start" "stop" "lib.css" "psh" )
(allow "myFoo")
(allow "myDir/" T)
(test '(("psh" ("lib.css" NIL "myFoo") "start" NIL "stop") "app/" "myDir/")
*Allow )
(test '("lib.css" "myFoo" "psh" "start" "stop")
(idx *Allow) )
(test '("app/" "myDir/")
(cdr *Allow) )
### telStr ###
(test "+49 1234 5678-0" (telStr "49 1234 5678-0"))
(locale "DE" "de")
(test "01234 5678-0" (telStr "49 1234 5678-0"))
(locale)
### expTel ###
(test "49 1234 5678-0" (expTel "+49 1234 5678-0"))
(test "49 1234 5678-0" (expTel "0049 1234 5678-0"))
(test NIL (expTel "01234 5678-0"))
(locale "DE" "de")
(test "49 1234 5678-0" (expTel "01234 5678-0"))
(locale)
### dat$ ###
(test "20070601" (dat$ (date 2007 6 1)))
(test "2007-06-01" (dat$ (date 2007 6 1) "-"))
### $dat ###
(test 733134 ($dat "20070601"))
(test 733134 ($dat "2007-06-01" "-"))
### datSym ###
(test "01jun07" (datSym (date 2007 6 1)))
### datStr ###
(test "2007-06-01" (datStr (date 2007 6 1)))
(locale "DE" "de")
(test "01.06.2007" (datStr (date 2007 6 1)))
(test "01.06.07" (datStr (date 2007 6 1) T))
(locale)
### strDat ###
(test 733134 (strDat "2007-06-01"))
(test NIL (strDat "01.06.2007"))
(locale "DE" "de")
(test 733134 (strDat "01.06.2007"))
(test 733134 (strDat "1.6.2007"))
(locale)
### expDat ###
(test 733133 (date 2007 5 31))
(test 733133 (expDat "31057"))
(test 733133 (expDat "310507"))
(test 733133 (expDat "2007-05-31"))
(test 733133 (expDat "7-5-31"))
(let D (date)
(test D (expDat "."))
(test (inc D) (expDat "+1"))
(test (dec D) (expDat "-1")) )
(locale "DE" "de")
(test 733133 (expDat "31.5.7"))
(locale)
### day ###
(test "Friday" (day (date 2007 6 1)))
(locale "DE" "de")
(test "Freitag" (day (date 2007 6 1)))
(test "Fr"
(day (date 2007 6 1) '("Mo" "Tu" "We" "Th" "Fr" "Sa" "Su")) )
(locale)
### week ###
(test 22 (week (date 2007 6 1)))
### ultimo ###
(test (2007 1 31) (date (ultimo 2007 1)))
(test (2007 2 28) (date (ultimo 2007 2)))
(test (2004 2 29) (date (ultimo 2004 2)))
(test (2000 2 29) (date (ultimo 2000 2)))
(test (1900 2 28) (date (ultimo 1900 2)))
### tim$ ###
(test "10:57" (tim$ (time 10 57 56)))
(test "10:57:56" (tim$ (time 10 57 56) T))
### $tim ###
(test (10 57 56) (time ($tim "10:57:56")))
(test (10 57 0) (time ($tim "10:57")))
(test (10 0 0) (time ($tim "10")))
### stamp ###
(test "2007-06-01 10:57:56"
(stamp (date 2007 6 1) (time 10 57 56)) )
### chdir ###
(let P (pwd)
(chdir "/"
(test "/" (pwd)) )
(test P *PWD) )
### dirname basename ###
(test "a/b/c/" (dirname "a/b/c/d"))
(test "a/b/c/" (dirname "a/b/c/d/"))
(test "d" (basename "a/b/c/d"))
(test "d" (basename "a/b/c/d/"))
|