blob: d734b3b6aabfbbf5d1faba8dd8cbf7ed65bb6851 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/fastlib/text/unicodeutil.h>
#include <vespa/vespalib/testkit/test_kit.h>
TEST("GetUTF8Char_WrongInput") {
const char *testdata = "ab\xF8";
ucs4_t the_char = 0;
const unsigned char *src = reinterpret_cast<const unsigned char *>(testdata);
while (*src != 0) {
the_char = Fast_UnicodeUtil::GetUTF8Char(src);
}
EXPECT_EQUAL(Fast_UnicodeUtil::_BadUTF8Char, the_char);
}
TEST("IsTerminalPunctuationChar") {
// test a small selection
EXPECT_TRUE(Fast_UnicodeUtil::IsTerminalPunctuationChar('!'));
EXPECT_TRUE(Fast_UnicodeUtil::IsTerminalPunctuationChar(','));
EXPECT_TRUE(Fast_UnicodeUtil::IsTerminalPunctuationChar('.'));
EXPECT_TRUE(Fast_UnicodeUtil::IsTerminalPunctuationChar(':'));
EXPECT_TRUE(Fast_UnicodeUtil::IsTerminalPunctuationChar(';'));
EXPECT_FALSE(Fast_UnicodeUtil::IsTerminalPunctuationChar(' '));
EXPECT_FALSE(Fast_UnicodeUtil::IsTerminalPunctuationChar('a'));
EXPECT_FALSE(Fast_UnicodeUtil::IsTerminalPunctuationChar('A'));
}
TEST_MAIN() { TEST_RUN_ALL(); }
|