MCPcopy Create free account
hub / github.com/catboost/catboost / Y_UNIT_TEST

Function Y_UNIT_TEST

util/string/ascii_ut.cpp:7–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5
6Y_UNIT_TEST_SUITE(TAsciiTest) {
7 Y_UNIT_TEST(TestAscii) {
8 UNIT_ASSERT(IsAsciiDigit('3'));
9 UNIT_ASSERT(!IsAsciiDigit('x'));
10
11 UNIT_ASSERT(IsAsciiAlpha('r'));
12 UNIT_ASSERT(IsAsciiAlpha('R'));
13 UNIT_ASSERT(!IsAsciiAlpha('3'));
14
15 UNIT_ASSERT_EQUAL(AsciiToLower('3'), '3');
16 UNIT_ASSERT_EQUAL(AsciiToLower('A'), 'a');
17 UNIT_ASSERT_EQUAL(AsciiToLower('a'), 'a');
18
19 UNIT_ASSERT_EQUAL(AsciiToUpper('3'), '3');
20 UNIT_ASSERT_EQUAL(AsciiToUpper('A'), 'A');
21 UNIT_ASSERT_EQUAL(AsciiToUpper('a'), 'A');
22
23 UNIT_ASSERT(IsAscii('a'));
24 UNIT_ASSERT(!IsAscii(-100));
25 UNIT_ASSERT(!IsAscii(+200));
26 UNIT_ASSERT(!IsAscii(int('a') + 256));
27
28 for (int i = 0; i < 128; ++i) {
29 UNIT_ASSERT_VALUES_EQUAL((bool)isxdigit(i), IsAsciiHex(i));
30 UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i));
31 UNIT_ASSERT_VALUES_EQUAL((bool)isspace(i), IsAsciiSpace((char)i));
32 UNIT_ASSERT_VALUES_EQUAL((bool)isalnum(i), IsAsciiAlnum((char)i));
33 UNIT_ASSERT_VALUES_EQUAL((bool)isalpha(i), IsAsciiAlpha((char)i));
34 UNIT_ASSERT_VALUES_EQUAL((bool)isupper(i), IsAsciiUpper((char)i));
35 UNIT_ASSERT_VALUES_EQUAL((bool)islower(i), IsAsciiLower((char)i));
36 UNIT_ASSERT_VALUES_EQUAL((bool)isdigit(i), IsAsciiDigit((char)i));
37 UNIT_ASSERT_VALUES_EQUAL((bool)ispunct(i), IsAsciiPunct((char)i));
38 }
39 }
40
41 Y_UNIT_TEST(Test1) {
42 for (int i = 128; i < 1000; ++i) {

Callers

nothing calls this directly

Calls 15

IsAsciiAlphaFunction · 0.85
AsciiToLowerFunction · 0.85
AsciiToUpperFunction · 0.85
IsAsciiFunction · 0.85
IsAsciiHexFunction · 0.85
IsAsciiSpaceFunction · 0.85
IsAsciiAlnumFunction · 0.85
IsAsciiUpperFunction · 0.85
IsAsciiLowerFunction · 0.85
AsciiEqualsIgnoreCaseFunction · 0.85
AsciiHasPrefixFunction · 0.85
AsciiHasPrefixIgnoreCaseFunction · 0.85

Tested by

no test coverage detected