aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorr00ster91 <r00ster91@proton.me>2022-11-03 23:02:30 +0100
committerr00ster91 <r00ster91@proton.me>2022-12-09 21:57:17 +0100
commit45650f7003ba84d7188bace63df7a52265b6561e (patch)
tree9507f7f58132d6868bc3f726bdc64d6ed499b7a0 /lib/std
parent0162a0868c18dc94f8d89c0c95bd89ebd63c0b41 (diff)
downloadzig-45650f7003ba84d7188bace63df7a52265b6561e.tar.gz
zig-45650f7003ba84d7188bace63df7a52265b6561e.zip
std.ascii: more tests
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/ascii.zig23
1 files changed, 21 insertions, 2 deletions
diff --git a/lib/std/ascii.zig b/lib/std/ascii.zig
index facabaf795..79038a37dc 100644
--- a/lib/std/ascii.zig
+++ b/lib/std/ascii.zig
@@ -200,9 +200,11 @@ test "ASCII character classes" {
try testing.expect(!isControl('a'));
try testing.expect(!isControl('z'));
+ try testing.expect(!isControl(' '));
try testing.expect(isControl(control_code.nul));
try testing.expect(isControl(control_code.ff));
try testing.expect(isControl(control_code.us));
+ try testing.expect(isControl(control_code.del));
try testing.expect(!isControl(0x80));
try testing.expect(!isControl(0xff));
@@ -210,36 +212,53 @@ test "ASCII character classes" {
try testing.expect(':' == toUpper(':'));
try testing.expect('\xab' == toUpper('\xab'));
try testing.expect(!isUpper('z'));
+ try testing.expect(!isUpper(0x80));
+ try testing.expect(!isUpper(0xff));
try testing.expect('c' == toLower('C'));
try testing.expect(':' == toLower(':'));
try testing.expect('\xab' == toLower('\xab'));
try testing.expect(!isLower('Z'));
+ try testing.expect(!isLower(0x80));
+ try testing.expect(!isLower(0xff));
try testing.expect(isAlphanumeric('Z'));
try testing.expect(isAlphanumeric('z'));
try testing.expect(isAlphanumeric('5'));
- try testing.expect(isAlphanumeric('5'));
+ try testing.expect(isAlphanumeric('a'));
try testing.expect(!isAlphanumeric('!'));
+ try testing.expect(!isAlphanumeric(0x80));
+ try testing.expect(!isAlphanumeric(0xff));
try testing.expect(!isAlphabetic('5'));
try testing.expect(isAlphabetic('c'));
- try testing.expect(!isAlphabetic('5'));
+ try testing.expect(!isAlphabetic('@'));
+ try testing.expect(isAlphabetic('Z'));
+ try testing.expect(!isAlphabetic(0x80));
+ try testing.expect(!isAlphabetic(0xff));
try testing.expect(isWhitespace(' '));
try testing.expect(isWhitespace('\t'));
try testing.expect(isWhitespace('\r'));
try testing.expect(isWhitespace('\n'));
+ try testing.expect(isWhitespace(control_code.ff));
try testing.expect(!isWhitespace('.'));
+ try testing.expect(!isWhitespace(control_code.us));
+ try testing.expect(!isWhitespace(0x80));
+ try testing.expect(!isWhitespace(0xff));
try testing.expect(!isHex('g'));
try testing.expect(isHex('b'));
try testing.expect(isHex('F'));
try testing.expect(isHex('9'));
+ try testing.expect(!isHex(0x80));
+ try testing.expect(!isHex(0xff));
try testing.expect(!isDigit('~'));
try testing.expect(isDigit('0'));
try testing.expect(isDigit('9'));
+ try testing.expect(!isDigit(0x80));
+ try testing.expect(!isDigit(0xff));
try testing.expect(isPrint(' '));
try testing.expect(isPrint('@'));