Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
strfunctest.cpp
Go to the documentation of this file.
1
// Tencent is pleased to support the open source community by making RapidJSON available.
2
//
3
// Copyright (C) 2015 THL A29 Limited, a Tencent company, and Milo Yip. All rights reserved.
4
//
5
// Licensed under the MIT License (the "License"); you may not use this file except
6
// in compliance with the License. You may obtain a copy of the License at
7
//
8
// http://opensource.org/licenses/MIT
9
//
10
// Unless required by applicable law or agreed to in writing, software distributed
11
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
12
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
13
// specific language governing permissions and limitations under the License.
14
15
#include "
unittest.h
"
16
#include "
rapidjson/internal/strfunc.h
"
17
18
using namespace
rapidjson
;
19
using namespace
rapidjson::internal;
20
21
TEST
(StrFunc, CountStringCodePoint) {
22
SizeType
count;
23
EXPECT_TRUE
(CountStringCodePoint<
UTF8<>
>(
""
, 0, &count));
24
EXPECT_EQ
(0u, count);
25
EXPECT_TRUE
(CountStringCodePoint<
UTF8<>
>(
"Hello"
, 5, &count));
26
EXPECT_EQ
(5u, count);
27
EXPECT_TRUE
(CountStringCodePoint<
UTF8<>
>(
"\xC2\xA2\xE2\x82\xAC\xF0\x9D\x84\x9E"
, 9, &count));
// cents euro G-clef
28
EXPECT_EQ
(3u, count);
29
EXPECT_FALSE
(CountStringCodePoint<
UTF8<>
>(
"\xC2\xA2\xE2\x82\xAC\xF0\x9D\x84\x9E\x80"
, 10, &count));
30
}
EXPECT_EQ
#define EXPECT_EQ(val1, val2)
Definition
gtest.h:1922
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition
gtest.h:1859
TEST
#define TEST(test_case_name, test_name)
Definition
gtest.h:2187
EXPECT_FALSE
#define EXPECT_FALSE(condition)
Definition
gtest.h:1862
rapidjson
main RapidJSON namespace
SizeType
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.).
Definition
rapidjson.h:389
strfunc.h
UTF8
UTF-8 encoding.
Definition
encodings.h:96
unittest.h
external
rapidjson
test
unittest
strfunctest.cpp
Generated on
for Electroneum by
1.17.0