authorgravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-11-03 23:02:30+01:00
committergravatar for r00ster91@proton.meWooster <r00ster91@proton.me> 2022-12-09 21:57:17+01:00
log45650f7003ba84d7188bace63df7a52265b6561e
tree9507f7f58132d6868bc3f726bdc64d6ed499b7a0
parent0162a0868c18dc94f8d89c0c95bd89ebd63c0b41

std.ascii: more tests


1 files changed, 21 insertions(+), 2 deletions(-)

lib/std/ascii.zig+21-2
...@@ -200,9 +200,11 @@ test "ASCII character classes" {...@@ -200,9 +200,11 @@ test "ASCII character classes" {
200200
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));
208210
...@@ -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));
213217
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));
218224
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));
224232
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));
228239
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));
234249
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));
239256
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));
243262
244 try testing.expect(isPrint(' '));263 try testing.expect(isPrint(' '));
245 try testing.expect(isPrint('@'));264 try testing.expect(isPrint('@'));