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" {
200200
201201 try testing.expect(!isControl('a'));
202202 try testing.expect(!isControl('z'));
203 try testing.expect(!isControl(' '));
203204 try testing.expect(isControl(control_code.nul));
204205 try testing.expect(isControl(control_code.ff));
205206 try testing.expect(isControl(control_code.us));
207 try testing.expect(isControl(control_code.del));
206208 try testing.expect(!isControl(0x80));
207209 try testing.expect(!isControl(0xff));
208210
......@@ -210,36 +212,53 @@ test "ASCII character classes" {
210212 try testing.expect(':' == toUpper(':'));
211213 try testing.expect('\xab' == toUpper('\xab'));
212214 try testing.expect(!isUpper('z'));
215 try testing.expect(!isUpper(0x80));
216 try testing.expect(!isUpper(0xff));
213217
214218 try testing.expect('c' == toLower('C'));
215219 try testing.expect(':' == toLower(':'));
216220 try testing.expect('\xab' == toLower('\xab'));
217221 try testing.expect(!isLower('Z'));
222 try testing.expect(!isLower(0x80));
223 try testing.expect(!isLower(0xff));
218224
219225 try testing.expect(isAlphanumeric('Z'));
220226 try testing.expect(isAlphanumeric('z'));
221227 try testing.expect(isAlphanumeric('5'));
222 try testing.expect(isAlphanumeric('5'));
228 try testing.expect(isAlphanumeric('a'));
223229 try testing.expect(!isAlphanumeric('!'));
230 try testing.expect(!isAlphanumeric(0x80));
231 try testing.expect(!isAlphanumeric(0xff));
224232
225233 try testing.expect(!isAlphabetic('5'));
226234 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
229240 try testing.expect(isWhitespace(' '));
230241 try testing.expect(isWhitespace('\t'));
231242 try testing.expect(isWhitespace('\r'));
232243 try testing.expect(isWhitespace('\n'));
244 try testing.expect(isWhitespace(control_code.ff));
233245 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
235250 try testing.expect(!isHex('g'));
236251 try testing.expect(isHex('b'));
237252 try testing.expect(isHex('F'));
238253 try testing.expect(isHex('9'));
254 try testing.expect(!isHex(0x80));
255 try testing.expect(!isHex(0xff));
239256
240257 try testing.expect(!isDigit('~'));
241258 try testing.expect(isDigit('0'));
242259 try testing.expect(isDigit('9'));
260 try testing.expect(!isDigit(0x80));
261 try testing.expect(!isDigit(0xff));
243262
244263 try testing.expect(isPrint(' '));
245264 try testing.expect(isPrint('@'));