lib/std/char/tests.rad 1.5 KiB raw
1
use std::testing;
2
3
@test fn testIsDigit() throws (testing::TestError) {
4
    try testing::expect(super::isDigit('0'));
5
    try testing::expect(super::isDigit('9'));
6
    try testing::expectNot(super::isDigit('/'));
7
    try testing::expectNot(super::isDigit(':'));
8
}
9
10
@test fn testIsHexDigit() throws (testing::TestError) {
11
    try testing::expect(super::isHexDigit('0'));
12
    try testing::expect(super::isHexDigit('9'));
13
    try testing::expect(super::isHexDigit('a'));
14
    try testing::expect(super::isHexDigit('f'));
15
    try testing::expect(super::isHexDigit('A'));
16
    try testing::expect(super::isHexDigit('F'));
17
    try testing::expectNot(super::isHexDigit('g'));
18
    try testing::expectNot(super::isHexDigit('G'));
19
}
20
21
@test fn testIsBinDigit() throws (testing::TestError) {
22
    try testing::expect(super::isBinDigit('0'));
23
    try testing::expect(super::isBinDigit('1'));
24
    try testing::expectNot(super::isBinDigit('2'));
25
    try testing::expectNot(super::isBinDigit('a'));
26
}
27
28
@test fn testIsAlpha() throws (testing::TestError) {
29
    try testing::expect(super::isAlpha('a'));
30
    try testing::expect(super::isAlpha('z'));
31
    try testing::expect(super::isAlpha('A'));
32
    try testing::expect(super::isAlpha('Z'));
33
    try testing::expectNot(super::isAlpha('0'));
34
    try testing::expectNot(super::isAlpha('_'));
35
}
36
37
@test fn testIsPrint() throws (testing::TestError) {
38
    try testing::expect(super::isPrint(' '));
39
    try testing::expect(super::isPrint('~'));
40
    try testing::expectNot(super::isPrint(31));
41
    try testing::expectNot(super::isPrint(127));
42
}