23#if defined(_MSC_VER) && !defined(__clang__)
25RAPIDJSON_DIAG_OFF(4702)
31template <
typename StringStreamType>
32static void TestStringStream() {
33 typedef typename StringStreamType::char_type
Ch;
39 if (
sizeof(
Ch) == 1) {
49 Ch s[] = {
'A',
'B',
'C',
'\0' };
50 StringStreamType iss(
s);
53 if (
sizeof(
Ch) == 1) {
56 for (
int i = 0; i < 3; i++) {
57 EXPECT_EQ(
static_cast<size_t>(i), is.Tell());
68 Ch s[] = {
'A',
'B',
'C',
'D',
'E',
'\0' };
69 StringStreamType iss(
s);
71 if (
sizeof(
Ch) == 1) {
72 const Ch* c = is.Peek4();
73 for (
int i = 0; i < 4; i++)
77 for (
int i = 0; i < 5; i++) {
78 EXPECT_EQ(
static_cast<size_t>(i), is.Tell());
90 TestStringStream<istringstream>();
94 TestStringStream<stringstream>();
98 TestStringStream<wistringstream>();
102 TestStringStream<wstringstream>();
105template <
typename FileStreamType>
106static bool Open(FileStreamType& fs,
const char* filename) {
107 const char *paths[] = {
111 "../../bin/encodings",
112 "../../../bin/encodings"
115 for (
size_t i = 0; i <
sizeof(paths) /
sizeof(paths[0]); i++) {
116 sprintf(buffer,
"%s/%s", paths[i], filename);
117 fs.open(buffer, ios_base::in | ios_base::binary);
154 ifs.imbue(std::locale(ifs.getloc(),
155 new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
167 fs.imbue(std::locale(
fs.getloc(),
168 new std::codecvt_utf16<wchar_t, 0x10ffff, std::consume_header>));
179#if defined(_MSC_VER) && !defined(__clang__)
Wrapper of std::basic_istream into RapidJSON's Stream concept.
#define EXPECT_EQ(val1, val2)
#define EXPECT_TRUE(condition)
#define TEST(test_case_name, test_name)
#define ASSERT_TRUE(condition)
static const Segment fs(Segment::fs)
@ kParseDefaultFlags
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS.