Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
rapidjsontest.cpp File Reference
Include dependency graph for rapidjsontest.cpp:

Go to the source code of this file.

Classes

class  RapidJson
 
struct  ValueCounter
 
struct  NullStream
 

Macros

#define SIMD_SUFFIX(name)
 
#define TEST_TYPED(index, Name)
 
#define TEST_TYPED(index, Name)
 

Functions

 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_ValidateEncoding))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_FullPrecision))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseIterative_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseIterativeInsitu_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseIterativePull_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParseIterativePullInsitu_DummyHandler))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_ValidateEncoding))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseInsitu_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseIterativeInsitu_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParse_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseLength_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseStdString_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseIterative_MemoryPoolAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParse_CrtAllocator))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseEncodedInputStream_MemoryStream))
 
 TEST_F (RapidJson, SIMD_SUFFIX(DocumentParseAutoUTFInputStream_MemoryStream))
 
template<typename T >
size_t Traverse (const T &value)
 
 TEST_F (RapidJson, DocumentTraverse)
 
 TEST_F (RapidJson, DocumentAccept)
 
 TEST_F (RapidJson, Writer_NullStream)
 
 TEST_F (RapidJson, SIMD_SUFFIX(Writer_StringBuffer))
 
 TEST_F (RapidJson, SIMD_SUFFIX(PrettyWriter_StringBuffer))
 
 TEST_F (RapidJson, internal_Pow10)
 
 TEST_F (RapidJson, SkipWhitespace_Basic)
 
 TEST_F (RapidJson, SIMD_SUFFIX(SkipWhitespace))
 
 TEST_F (RapidJson, SkipWhitespace_strspn)
 
 TEST_F (RapidJson, UTF8_Validate)
 
 TEST_F (RapidJson, FileReadStream)
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_FileReadStream))
 
 TEST_F (RapidJson, IStreamWrapper)
 
 TEST_F (RapidJson, IStreamWrapper_Unbuffered)
 
 TEST_F (RapidJson, IStreamWrapper_Setbuffered)
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Unbuffered))
 
 TEST_F (RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Setbuffered))
 
 TEST_F (RapidJson, StringBuffer)
 

Macro Definition Documentation

◆ SIMD_SUFFIX

#define SIMD_SUFFIX ( name)
Value:
std::string name

Definition at line 37 of file rapidjsontest.cpp.

◆ TEST_TYPED [1/2]

#define TEST_TYPED ( index,
Name )
Value:
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_##Name)) {\
for (size_t i = 0; i < kTrialCount * 10; i++) {\
StringStream s(types_[index]);\
Reader reader;\
EXPECT_TRUE(reader.Parse(s, h));\
}\
}\
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_##Name)) {\
for (size_t i = 0; i < kTrialCount * 10; i++) {\
memcpy(temp_, types_[index], typesLength_[index] + 1);\
Reader reader;\
EXPECT_TRUE(reader.Parse<kParseInsituFlag>(s, h));\
}\
}
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition reader.h:557
#define TEST_F(test_fixture, test_name)
Definition gtest.h:2304
#define SIMD_SUFFIX(name)
@ kParseInsituFlag
In-situ(destructive) parsing.
Definition reader.h:147
Default implementation of Handler.
Definition reader.h:196
Read-only string stream.
Definition stream.h:154
char * s

Definition at line 103 of file rapidjsontest.cpp.

103#define TEST_TYPED(index, Name)\
104TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_##Name)) {\
105 for (size_t i = 0; i < kTrialCount * 10; i++) {\
106 StringStream s(types_[index]);\
107 BaseReaderHandler<> h;\
108 Reader reader;\
109 EXPECT_TRUE(reader.Parse(s, h));\
110 }\
111}\
112TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_##Name)) {\
113 for (size_t i = 0; i < kTrialCount * 10; i++) {\
114 memcpy(temp_, types_[index], typesLength_[index] + 1);\
115 InsituStringStream s(temp_);\
116 BaseReaderHandler<> h;\
117 Reader reader;\
118 EXPECT_TRUE(reader.Parse<kParseInsituFlag>(s, h));\
119 }\
120}

◆ TEST_TYPED [2/2]

#define TEST_TYPED ( index,
Name )
Value:
TEST_F(RapidJson, SIMD_SUFFIX(Writer_StringBuffer_##Name)) {\
for (size_t i = 0; i < kTrialCount * 10; i++) {\
StringBuffer s(0, 1024 * 1024);\
typesDoc_[index].Accept(writer);\
const char* str = s.GetString();\
(void)str;\
}\
}
JSON writer.
Definition writer.h:89

Definition at line 103 of file rapidjsontest.cpp.

103#define TEST_TYPED(index, Name)\
104TEST_F(RapidJson, SIMD_SUFFIX(ReaderParse_DummyHandler_##Name)) {\
105 for (size_t i = 0; i < kTrialCount * 10; i++) {\
106 StringStream s(types_[index]);\
107 BaseReaderHandler<> h;\
108 Reader reader;\
109 EXPECT_TRUE(reader.Parse(s, h));\
110 }\
111}\
112TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_##Name)) {\
113 for (size_t i = 0; i < kTrialCount * 10; i++) {\
114 memcpy(temp_, types_[index], typesLength_[index] + 1);\
115 InsituStringStream s(temp_);\
116 BaseReaderHandler<> h;\
117 Reader reader;\
118 EXPECT_TRUE(reader.Parse<kParseInsituFlag>(s, h));\
119 }\
120}

Function Documentation

◆ TEST_F() [1/37]

TEST_F ( RapidJson ,
DocumentAccept  )

Definition at line 330 of file rapidjsontest.cpp.

330 {
331 for (size_t i = 0; i < kTrialCount; i++) {
332 ValueCounter counter;
333 doc_.Accept(counter);
334 EXPECT_EQ(4339u, counter.count_);
335 }
336}
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954

◆ TEST_F() [2/37]

TEST_F ( RapidJson ,
DocumentTraverse  )

Definition at line 303 of file rapidjsontest.cpp.

303 {
304 for (size_t i = 0; i < kTrialCount; i++) {
305 size_t count = Traverse(doc_);
306 EXPECT_EQ(4339u, count);
307 //if (i == 0)
308 // std::cout << count << std::endl;
309 }
310}
int * count
size_t Traverse(const T &value)
Here is the call graph for this function:

◆ TEST_F() [3/37]

TEST_F ( RapidJson ,
FileReadStream  )

Definition at line 446 of file rapidjsontest.cpp.

446 {
447 for (size_t i = 0; i < kTrialCount; i++) {
448 FILE *fp = fopen(filename_, "rb");
449 char buffer[65536];
450 FileReadStream s(fp, buffer, sizeof(buffer));
451 while (s.Take() != '\0')
452 ;
453 fclose(fp);
454 }
455}
File byte stream for input using fread().

◆ TEST_F() [4/37]

TEST_F ( RapidJson ,
internal_Pow10  )

Definition at line 403 of file rapidjsontest.cpp.

403 {
404 double sum = 0;
405 for (size_t i = 0; i < kTrialCount * kTrialCount; i++)
406 sum += internal::Pow10(int(i & 255));
407 EXPECT_GT(sum, 0.0);
408}
#define EXPECT_GT(val1, val2)
Definition gtest.h:1966
double Pow10(int n)
Computes integer powers of 10 in double (10.0^n).
Definition pow10.h:28
Here is the call graph for this function:

◆ TEST_F() [5/37]

TEST_F ( RapidJson ,
IStreamWrapper  )

Definition at line 469 of file rapidjsontest.cpp.

469 {
470 for (size_t i = 0; i < kTrialCount; i++) {
471 std::ifstream is(filename_, std::ios::in | std::ios::binary);
472 char buffer[65536];
473 IStreamWrapper isw(is, buffer, sizeof(buffer));
474 while (isw.Take() != '\0')
475 ;
476 is.close();
477 }
478}
Here is the call graph for this function:

◆ TEST_F() [6/37]

TEST_F ( RapidJson ,
IStreamWrapper_Setbuffered  )

Definition at line 490 of file rapidjsontest.cpp.

490 {
491 for (size_t i = 0; i < kTrialCount; i++) {
492 std::ifstream is;
493 char buffer[65536];
494 is.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
495 is.open(filename_, std::ios::in | std::ios::binary);
496 IStreamWrapper isw(is);
497 while (isw.Take() != '\0')
498 ;
499 is.close();
500 }
501}
Here is the call graph for this function:

◆ TEST_F() [7/37]

TEST_F ( RapidJson ,
IStreamWrapper_Unbuffered  )

Definition at line 480 of file rapidjsontest.cpp.

480 {
481 for (size_t i = 0; i < kTrialCount; i++) {
482 std::ifstream is(filename_, std::ios::in | std::ios::binary);
483 IStreamWrapper isw(is);
484 while (isw.Take() != '\0')
485 ;
486 is.close();
487 }
488}
Here is the call graph for this function:

◆ TEST_F() [8/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParse_CrtAllocator)  )

Definition at line 251 of file rapidjsontest.cpp.

251 {
252 for (size_t i = 0; i < kTrialCount; i++) {
253 memcpy(temp_, json_, length_ + 1);
255 doc.Parse(temp_);
256 ASSERT_TRUE(doc.IsObject());
257 }
258}
C-runtime library allocator.
Definition allocators.h:75
A document for parsing JSON text as DOM.
Definition document.h:2124
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition document.h:2325
#define ASSERT_TRUE(condition)
Definition gtest.h:1901
memcpy((char *) pInfo->slotDescription, s, l)
Here is the call graph for this function:

◆ TEST_F() [9/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParse_MemoryPoolAllocator)  )

Definition at line 216 of file rapidjsontest.cpp.

216 {
217 for (size_t i = 0; i < kTrialCount; i++) {
218 Document doc;
219 doc.Parse(json_);
220 ASSERT_TRUE(doc.IsObject());
221 }
222}
Here is the call graph for this function:

◆ TEST_F() [10/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseAutoUTFInputStream_MemoryStream)  )

Definition at line 270 of file rapidjsontest.cpp.

270 {
271 for (size_t i = 0; i < kTrialCount; i++) {
272 MemoryStream ms(json_, length_);
274 Document doc;
275 doc.ParseStream<0, AutoUTF<unsigned> >(is);
276 ASSERT_TRUE(doc.IsObject());
277 }
278}
Input stream wrapper with dynamically bound encoding and automatic encoding detection.
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream (with Encoding conversion)
Definition document.h:2259
Dynamically select encoding according to stream's runtime-specified UTF encoding type.
Definition encodings.h:615
Represents an in-memory input byte stream.
Here is the call graph for this function:

◆ TEST_F() [11/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseEncodedInputStream_MemoryStream)  )

Definition at line 260 of file rapidjsontest.cpp.

260 {
261 for (size_t i = 0; i < kTrialCount; i++) {
262 MemoryStream ms(json_, length_);
264 Document doc;
265 doc.ParseStream<0, UTF8<> >(is);
266 ASSERT_TRUE(doc.IsObject());
267 }
268}
Input byte stream wrapper with a statically bound encoding.
UTF-8 encoding.
Definition encodings.h:96
Here is the call graph for this function:

◆ TEST_F() [12/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseInsitu_MemoryPoolAllocator)  )

Definition at line 198 of file rapidjsontest.cpp.

198 {
199 for (size_t i = 0; i < kTrialCount; i++) {
200 memcpy(temp_, json_, length_ + 1);
201 Document doc;
202 doc.ParseInsitu(temp_);
203 ASSERT_TRUE(doc.IsObject());
204 }
205}
GenericDocument & ParseInsitu(Ch *str)
Parse JSON text from a mutable string.
Definition document.h:2302
Here is the call graph for this function:

◆ TEST_F() [13/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseIterative_MemoryPoolAllocator)  )

Definition at line 243 of file rapidjsontest.cpp.

243 {
244 for (size_t i = 0; i < kTrialCount; i++) {
245 Document doc;
246 doc.Parse<kParseIterativeFlag>(json_);
247 ASSERT_TRUE(doc.IsObject());
248 }
249}
@ kParseIterativeFlag
Iterative(constant complexity in terms of function call stack size) parsing.
Definition reader.h:149
Here is the call graph for this function:

◆ TEST_F() [14/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseIterativeInsitu_MemoryPoolAllocator)  )

Definition at line 207 of file rapidjsontest.cpp.

207 {
208 for (size_t i = 0; i < kTrialCount; i++) {
209 memcpy(temp_, json_, length_ + 1);
210 Document doc;
212 ASSERT_TRUE(doc.IsObject());
213 }
214}
Here is the call graph for this function:

◆ TEST_F() [15/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseLength_MemoryPoolAllocator)  )

Definition at line 224 of file rapidjsontest.cpp.

224 {
225 for (size_t i = 0; i < kTrialCount; i++) {
226 Document doc;
227 doc.Parse(json_, length_);
228 ASSERT_TRUE(doc.IsObject());
229 }
230}
Here is the call graph for this function:

◆ TEST_F() [16/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(DocumentParseStdString_MemoryPoolAllocator)  )

Definition at line 233 of file rapidjsontest.cpp.

233 {
234 const std::string s(json_, length_);
235 for (size_t i = 0; i < kTrialCount; i++) {
236 Document doc;
237 doc.Parse(s);
238 ASSERT_TRUE(doc.IsObject());
239 }
240}
Here is the call graph for this function:

◆ TEST_F() [17/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(PrettyWriter_StringBuffer)  )

Definition at line 390 of file rapidjsontest.cpp.

390 {
391 for (size_t i = 0; i < kTrialCount; i++) {
392 StringBuffer s(0, 2048 * 1024);
394 writer.SetIndent(' ', 1);
395 doc_.Accept(writer);
396 const char* str = s.GetString();
397 (void)str;
398 //if (i == 0)
399 // std::cout << strlen(str) << std::endl;
400 }
401}
Writer with indentation and spacing.
return str
Definition CLI11.hpp:1359
Here is the call graph for this function:

◆ TEST_F() [18/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler)  )

Definition at line 94 of file rapidjsontest.cpp.

94 {
95 for (size_t i = 0; i < kTrialCount; i++) {
96 StringStream s(json_);
98 Reader reader;
99 EXPECT_TRUE(reader.Parse(s, h));
100 }
101}
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
Here is the call graph for this function:

◆ TEST_F() [19/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_FileReadStream)  )

Definition at line 457 of file rapidjsontest.cpp.

457 {
458 for (size_t i = 0; i < kTrialCount; i++) {
459 FILE *fp = fopen(filename_, "rb");
460 char buffer[65536];
461 FileReadStream s(fp, buffer, sizeof(buffer));
463 Reader reader;
464 reader.Parse(s, h);
465 fclose(fp);
466 }
467}
Here is the call graph for this function:

◆ TEST_F() [20/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_FullPrecision)  )

Definition at line 132 of file rapidjsontest.cpp.

132 {
133 for (size_t i = 0; i < kTrialCount; i++) {
134 StringStream s(json_);
136 Reader reader;
138 }
139}
@ kParseFullPrecisionFlag
Parse number in full precision (but slower).
Definition reader.h:151
Here is the call graph for this function:

◆ TEST_F() [21/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper)  )

Definition at line 503 of file rapidjsontest.cpp.

503 {
504 for (size_t i = 0; i < kTrialCount; i++) {
505 std::ifstream is(filename_, std::ios::in | std::ios::binary);
506 char buffer[65536];
507 IStreamWrapper isw(is, buffer, sizeof(buffer));
509 Reader reader;
510 reader.Parse(isw, h);
511 is.close();
512 }
513}
Here is the call graph for this function:

◆ TEST_F() [22/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Setbuffered)  )

Definition at line 526 of file rapidjsontest.cpp.

526 {
527 for (size_t i = 0; i < kTrialCount; i++) {
528 std::ifstream is;
529 char buffer[65536];
530 is.rdbuf()->pubsetbuf(buffer, sizeof(buffer));
531 is.open(filename_, std::ios::in | std::ios::binary);
532 IStreamWrapper isw(is);
534 Reader reader;
535 reader.Parse(isw, h);
536 is.close();
537 }
538}
Here is the call graph for this function:

◆ TEST_F() [23/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_IStreamWrapper_Unbuffered)  )

Definition at line 515 of file rapidjsontest.cpp.

515 {
516 for (size_t i = 0; i < kTrialCount; i++) {
517 std::ifstream is(filename_, std::ios::in | std::ios::binary);
518 IStreamWrapper isw(is);
520 Reader reader;
521 reader.Parse(isw, h);
522 is.close();
523 }
524}
Here is the call graph for this function:

◆ TEST_F() [24/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParse_DummyHandler_ValidateEncoding)  )

Definition at line 189 of file rapidjsontest.cpp.

189 {
190 for (size_t i = 0; i < kTrialCount; i++) {
191 StringStream s(json_);
193 Reader reader;
195 }
196}
@ kParseValidateEncodingFlag
Validate encoding of JSON strings.
Definition reader.h:148
Here is the call graph for this function:

◆ TEST_F() [25/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseInsitu_DummyHandler)  )

Definition at line 74 of file rapidjsontest.cpp.

74 {
75 for (size_t i = 0; i < kTrialCount; i++) {
76 memcpy(temp_, json_, length_ + 1);
77 InsituStringStream s(temp_);
79 Reader reader;
81 }
82}
Here is the call graph for this function:

◆ TEST_F() [26/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_ValidateEncoding)  )

Definition at line 84 of file rapidjsontest.cpp.

84 {
85 for (size_t i = 0; i < kTrialCount; i++) {
86 memcpy(temp_, json_, length_ + 1);
87 InsituStringStream s(temp_);
89 Reader reader;
91 }
92}
Here is the call graph for this function:

◆ TEST_F() [27/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseIterative_DummyHandler)  )

Definition at line 141 of file rapidjsontest.cpp.

141 {
142 for (size_t i = 0; i < kTrialCount; i++) {
143 StringStream s(json_);
145 Reader reader;
147 }
148}
Here is the call graph for this function:

◆ TEST_F() [28/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseIterativeInsitu_DummyHandler)  )

Definition at line 150 of file rapidjsontest.cpp.

150 {
151 for (size_t i = 0; i < kTrialCount; i++) {
152 memcpy(temp_, json_, length_ + 1);
153 InsituStringStream s(temp_);
155 Reader reader;
157 }
158}
Here is the call graph for this function:

◆ TEST_F() [29/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseIterativePull_DummyHandler)  )

Definition at line 160 of file rapidjsontest.cpp.

160 {
161 for (size_t i = 0; i < kTrialCount; i++) {
162 StringStream s(json_);
164 Reader reader;
165 reader.IterativeParseInit();
166 while (!reader.IterativeParseComplete()) {
167 if (!reader.IterativeParseNext<kParseDefaultFlags>(s, h))
168 break;
169 }
170 EXPECT_FALSE(reader.HasParseError());
171 }
172}
bool IterativeParseNext(InputStream &is, Handler &handler)
Parse one token from JSON text.
Definition reader.h:618
void IterativeParseInit()
Initialize JSON text token-by-token parsing.
Definition reader.h:605
RAPIDJSON_FORCEINLINE bool IterativeParseComplete() const
Check if token-by-token parsing JSON text is complete.
Definition reader.h:675
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
Definition reader.h:680
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
@ kParseDefaultFlags
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS.
Definition reader.h:156
Here is the call graph for this function:

◆ TEST_F() [30/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(ReaderParseIterativePullInsitu_DummyHandler)  )

Definition at line 174 of file rapidjsontest.cpp.

174 {
175 for (size_t i = 0; i < kTrialCount; i++) {
176 memcpy(temp_, json_, length_ + 1);
177 InsituStringStream s(temp_);
179 Reader reader;
180 reader.IterativeParseInit();
181 while (!reader.IterativeParseComplete()) {
183 break;
184 }
185 EXPECT_FALSE(reader.HasParseError());
186 }
187}
Here is the call graph for this function:

◆ TEST_F() [31/37]

Definition at line 419 of file rapidjsontest.cpp.

419 {
420 for (size_t i = 0; i < kTrialCount; i++) {
421 rapidjson::StringStream s(whitespace_);
422 rapidjson::SkipWhitespace(s);
423 ASSERT_EQ('[', s.Peek());
424 }
425}
#define ASSERT_EQ(val1, val2)
Definition gtest.h:1988

◆ TEST_F() [32/37]

TEST_F ( RapidJson ,
SIMD_SUFFIX(Writer_StringBuffer)  )

Definition at line 357 of file rapidjsontest.cpp.

357 {
358 for (size_t i = 0; i < kTrialCount; i++) {
359 StringBuffer s(0, 1024 * 1024);
360 Writer<StringBuffer> writer(s);
361 doc_.Accept(writer);
362 const char* str = s.GetString();
363 (void)str;
364 //if (i == 0)
365 // std::cout << strlen(str) << std::endl;
366 }
367}

◆ TEST_F() [33/37]

TEST_F ( RapidJson ,
SkipWhitespace_Basic  )

Definition at line 410 of file rapidjsontest.cpp.

410 {
411 for (size_t i = 0; i < kTrialCount; i++) {
412 rapidjson::StringStream s(whitespace_);
413 while (s.Peek() == ' ' || s.Peek() == '\n' || s.Peek() == '\r' || s.Peek() == '\t')
414 s.Take();
415 ASSERT_EQ('[', s.Peek());
416 }
417}

◆ TEST_F() [34/37]

TEST_F ( RapidJson ,
SkipWhitespace_strspn  )

Definition at line 427 of file rapidjsontest.cpp.

427 {
428 for (size_t i = 0; i < kTrialCount; i++) {
429 const char* s = whitespace_ + std::strspn(whitespace_, " \t\r\n");
430 ASSERT_EQ('[', *s);
431 }
432}

◆ TEST_F() [35/37]

TEST_F ( RapidJson ,
StringBuffer  )

Definition at line 540 of file rapidjsontest.cpp.

540 {
541 StringBuffer sb;
542 for (int i = 0; i < 32 * 1024 * 1024; i++)
543 sb.Put(i & 0x7f);
544}
Here is the call graph for this function:

◆ TEST_F() [36/37]

TEST_F ( RapidJson ,
UTF8_Validate  )

Definition at line 434 of file rapidjsontest.cpp.

434 {
436
437 for (size_t i = 0; i < kTrialCount; i++) {
438 StringStream is(json_);
439 bool result = true;
440 while (is.Peek() != '\0')
441 result &= UTF8<>::Validate(is, os);
442 EXPECT_TRUE(result);
443 }
444}
os_t os

◆ TEST_F() [37/37]

TEST_F ( RapidJson ,
Writer_NullStream  )

Definition at line 347 of file rapidjsontest.cpp.

347 {
348 for (size_t i = 0; i < kTrialCount; i++) {
350 Writer<NullStream> writer(s);
351 doc_.Accept(writer);
352 //if (i == 0)
353 // std::cout << s.length_ << std::endl;
354 }
355}

◆ Traverse()

template<typename T >
size_t Traverse ( const T & value)

Definition at line 281 of file rapidjsontest.cpp.

281 {
282 size_t count = 1;
283 switch(value.GetType()) {
284 case kObjectType:
285 for (typename T::ConstMemberIterator itr = value.MemberBegin(); itr != value.MemberEnd(); ++itr) {
286 count++; // name
287 count += Traverse(itr->value);
288 }
289 break;
290
291 case kArrayType:
292 for (typename T::ConstValueIterator itr = value.Begin(); itr != value.End(); ++itr)
293 count += Traverse(*itr);
294 break;
295
296 default:
297 // Do nothing.
298 break;
299 }
300 return count;
301}
#define value
Definition pkcs11.h:157
@ kObjectType
object
Definition rapidjson.h:648
@ kArrayType
array
Definition rapidjson.h:649
Here is the call graph for this function:
Here is the caller graph for this function: