| ... | @@ -200,9 +200,11 @@ test "ASCII character classes" { | ... | @@ -200,9 +200,11 @@ test "ASCII character classes" { |
| 200 | | 200 | |
| 201 | try testing.expect(!isControl('a')); | 201 | try testing.expect(!isControl('a')); |
| 202 | try testing.expect(!isControl('z')); | 202 | try testing.expect(!isControl('z')); |
| | 203 | try testing.expect(!isControl(' ')); |
| 203 | try testing.expect(isControl(control_code.nul)); | 204 | try testing.expect(isControl(control_code.nul)); |
| 204 | try testing.expect(isControl(control_code.ff)); | 205 | try testing.expect(isControl(control_code.ff)); |
| 205 | try testing.expect(isControl(control_code.us)); | 206 | try testing.expect(isControl(control_code.us)); |
| | 207 | try testing.expect(isControl(control_code.del)); |
| 206 | try testing.expect(!isControl(0x80)); | 208 | try testing.expect(!isControl(0x80)); |
| 207 | try testing.expect(!isControl(0xff)); | 209 | try testing.expect(!isControl(0xff)); |
| 208 | | 210 | |
| ... | @@ -210,36 +212,53 @@ test "ASCII character classes" { | ... | @@ -210,36 +212,53 @@ test "ASCII character classes" { |
| 210 | try testing.expect(':' == toUpper(':')); | 212 | try testing.expect(':' == toUpper(':')); |
| 211 | try testing.expect('\xab' == toUpper('\xab')); | 213 | try testing.expect('\xab' == toUpper('\xab')); |
| 212 | try testing.expect(!isUpper('z')); | 214 | try testing.expect(!isUpper('z')); |
| | 215 | try testing.expect(!isUpper(0x80)); |
| | 216 | try testing.expect(!isUpper(0xff)); |
| 213 | | 217 | |
| 214 | try testing.expect('c' == toLower('C')); | 218 | try testing.expect('c' == toLower('C')); |
| 215 | try testing.expect(':' == toLower(':')); | 219 | try testing.expect(':' == toLower(':')); |
| 216 | try testing.expect('\xab' == toLower('\xab')); | 220 | try testing.expect('\xab' == toLower('\xab')); |
| 217 | try testing.expect(!isLower('Z')); | 221 | try testing.expect(!isLower('Z')); |
| | 222 | try testing.expect(!isLower(0x80)); |
| | 223 | try testing.expect(!isLower(0xff)); |
| 218 | | 224 | |
| 219 | try testing.expect(isAlphanumeric('Z')); | 225 | try testing.expect(isAlphanumeric('Z')); |
| 220 | try testing.expect(isAlphanumeric('z')); | 226 | try testing.expect(isAlphanumeric('z')); |
| 221 | try testing.expect(isAlphanumeric('5')); | 227 | try testing.expect(isAlphanumeric('5')); |
| 222 | try testing.expect(isAlphanumeric('5')); | 228 | try testing.expect(isAlphanumeric('a')); |
| 223 | try testing.expect(!isAlphanumeric('!')); | 229 | try testing.expect(!isAlphanumeric('!')); |
| | 230 | try testing.expect(!isAlphanumeric(0x80)); |
| | 231 | try testing.expect(!isAlphanumeric(0xff)); |
| 224 | | 232 | |
| 225 | try testing.expect(!isAlphabetic('5')); | 233 | try testing.expect(!isAlphabetic('5')); |
| 226 | try testing.expect(isAlphabetic('c')); | 234 | try testing.expect(isAlphabetic('c')); |
| 227 | try testing.expect(!isAlphabetic('5')); | 235 | try testing.expect(!isAlphabetic('@')); |
| | 236 | try testing.expect(isAlphabetic('Z')); |
| | 237 | try testing.expect(!isAlphabetic(0x80)); |
| | 238 | try testing.expect(!isAlphabetic(0xff)); |
| 228 | | 239 | |
| 229 | try testing.expect(isWhitespace(' ')); | 240 | try testing.expect(isWhitespace(' ')); |
| 230 | try testing.expect(isWhitespace('\t')); | 241 | try testing.expect(isWhitespace('\t')); |
| 231 | try testing.expect(isWhitespace('\r')); | 242 | try testing.expect(isWhitespace('\r')); |
| 232 | try testing.expect(isWhitespace('\n')); | 243 | try testing.expect(isWhitespace('\n')); |
| | 244 | try testing.expect(isWhitespace(control_code.ff)); |
| 233 | try testing.expect(!isWhitespace('.')); | 245 | try testing.expect(!isWhitespace('.')); |
| | 246 | try testing.expect(!isWhitespace(control_code.us)); |
| | 247 | try testing.expect(!isWhitespace(0x80)); |
| | 248 | try testing.expect(!isWhitespace(0xff)); |
| 234 | | 249 | |
| 235 | try testing.expect(!isHex('g')); | 250 | try testing.expect(!isHex('g')); |
| 236 | try testing.expect(isHex('b')); | 251 | try testing.expect(isHex('b')); |
| 237 | try testing.expect(isHex('F')); | 252 | try testing.expect(isHex('F')); |
| 238 | try testing.expect(isHex('9')); | 253 | try testing.expect(isHex('9')); |
| | 254 | try testing.expect(!isHex(0x80)); |
| | 255 | try testing.expect(!isHex(0xff)); |
| 239 | | 256 | |
| 240 | try testing.expect(!isDigit('~')); | 257 | try testing.expect(!isDigit('~')); |
| 241 | try testing.expect(isDigit('0')); | 258 | try testing.expect(isDigit('0')); |
| 242 | try testing.expect(isDigit('9')); | 259 | try testing.expect(isDigit('9')); |
| | 260 | try testing.expect(!isDigit(0x80)); |
| | 261 | try testing.expect(!isDigit(0xff)); |
| 243 | | 262 | |
| 244 | try testing.expect(isPrint(' ')); | 263 | try testing.expect(isPrint(' ')); |
| 245 | try testing.expect(isPrint('@')); | 264 | try testing.expect(isPrint('@')); |