hare

The Hare programming language
git clone https://git.torresjrjr.com/hare.git
Log | Files | Refs | README | LICENSE

commit 2d00164aec76d18da24bb53f63e1ac868607b433
parent 0b966ea2e192bcbc14167c4a41f661a89bab9e88
Author: Drew DeVault <sir@cmpwn.com>
Date:   Fri,  5 Feb 2021 11:55:13 -0500

ascii: add tests

Diffstat:
Mascii/ctype.ha | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/ascii/ctype.ha b/ascii/ctype.ha @@ -90,3 +90,13 @@ export fn tolower(c: rune) rune = { (c: u32 - ('A': u32) + ('a': u32)): rune; } else c; }; + +@test fn test() void = { + // Just some simple tests + assert(isspace(' ') && !isspace('x') && !isspace('こ')); + assert(isalnum('a') && isalnum('8') && !isalnum('こ')); + assert(!ispunct('\0') && iscntrl('\b')); + assert(isascii('a') && isascii('\0') && isascii('\x7F')); + assert(!isascii('\x80') && !isascii('こ')); + assert(tolower('A') == 'a' && tolower('こ') == 'こ'); +};