zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 45650f7003ba84d7188bace63df7a52265b6561e (tree)
parent 0162a0868c18dc94f8d89c0c95bd89ebd63c0b41
Author: r00ster91 <r00ster91@proton.me>
Date:   Thu,  3 Nov 2022 23:02:30 +0100

std.ascii: more tests

Diffstat:
Mlib/std/ascii.zig | 23+++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)

diff --git 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('@'));