Electroneum
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)   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, StringBuffer)
 

Macro Definition Documentation

◆ SIMD_SUFFIX

#define SIMD_SUFFIX (   name)    name

Definition at line 34 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]);\
BaseReaderHandler<> h;\
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);\
InsituStringStream s(temp_);\
BaseReaderHandler<> h;\
Reader reader;\
EXPECT_TRUE(reader.Parse<kParseInsituFlag>(s, h));\
}\
}
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler))
#define SIMD_SUFFIX(name)
In-situ(destructive) parsing.
Definition: reader.h:147

Definition at line 366 of file rapidjsontest.cpp.

◆ 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);\
Writer<StringBuffer> writer(s);\
typesDoc_[index].Accept(writer);\
const char* str = s.GetString();\
(void)str;\
}\
}
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler))
#define SIMD_SUFFIX(name)

Definition at line 366 of file rapidjsontest.cpp.

Function Documentation

◆ TEST_F() [1/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseInsitu_DummyHandler)   
)

Definition at line 71 of file rapidjsontest.cpp.

71  {
72  for (size_t i = 0; i < kTrialCount; i++) {
73  memcpy(temp_, json_, length_ + 1);
74  InsituStringStream s(temp_);
76  Reader reader;
77  EXPECT_TRUE(reader.Parse<kParseInsituFlag>(s, h));
78  }
79 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
void * memcpy(void *a, const void *b, size_t c)
In-situ(destructive) parsing.
Definition: reader.h:147
Here is the call graph for this function:

◆ TEST_F() [2/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseInsitu_DummyHandler_ValidateEncoding)   
)

Definition at line 81 of file rapidjsontest.cpp.

81  {
82  for (size_t i = 0; i < kTrialCount; i++) {
83  memcpy(temp_, json_, length_ + 1);
84  InsituStringStream s(temp_);
86  Reader reader;
88  }
89 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
void * memcpy(void *a, const void *b, size_t c)
Validate encoding of JSON strings.
Definition: reader.h:148
In-situ(destructive) parsing.
Definition: reader.h:147
Here is the call graph for this function:

◆ TEST_F() [3/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParse_DummyHandler)   
)

Definition at line 91 of file rapidjsontest.cpp.

91  {
92  for (size_t i = 0; i < kTrialCount; i++) {
93  StringStream s(json_);
95  Reader reader;
96  EXPECT_TRUE(reader.Parse(s, h));
97  }
98 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
Read-only string stream.
Definition: fwd.h:47
Here is the call graph for this function:

◆ TEST_F() [4/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParse_DummyHandler_FullPrecision)   
)

Definition at line 129 of file rapidjsontest.cpp.

129  {
130  for (size_t i = 0; i < kTrialCount; i++) {
131  StringStream s(json_);
133  Reader reader;
135  }
136 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
Parse number in full precision (but slower).
Definition: reader.h:151
Read-only string stream.
Definition: fwd.h:47
Here is the call graph for this function:

◆ TEST_F() [5/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseIterative_DummyHandler)   
)

Definition at line 138 of file rapidjsontest.cpp.

138  {
139  for (size_t i = 0; i < kTrialCount; i++) {
140  StringStream s(json_);
142  Reader reader;
143  EXPECT_TRUE(reader.Parse<kParseIterativeFlag>(s, h));
144  }
145 }
Iterative(constant complexity in terms of function call stack size) parsing.
Definition: reader.h:149
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
Read-only string stream.
Definition: fwd.h:47
Here is the call graph for this function:

◆ TEST_F() [6/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseIterativeInsitu_DummyHandler)   
)

Definition at line 147 of file rapidjsontest.cpp.

147  {
148  for (size_t i = 0; i < kTrialCount; i++) {
149  memcpy(temp_, json_, length_ + 1);
150  InsituStringStream s(temp_);
152  Reader reader;
154  }
155 }
Iterative(constant complexity in terms of function call stack size) parsing.
Definition: reader.h:149
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
void * memcpy(void *a, const void *b, size_t c)
In-situ(destructive) parsing.
Definition: reader.h:147
Here is the call graph for this function:

◆ TEST_F() [7/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseIterativePull_DummyHandler)   
)

Definition at line 157 of file rapidjsontest.cpp.

157  {
158  for (size_t i = 0; i < kTrialCount; i++) {
159  StringStream s(json_);
161  Reader reader;
162  reader.IterativeParseInit();
163  while (!reader.IterativeParseComplete()) {
164  if (!reader.IterativeParseNext<kParseDefaultFlags>(s, h))
165  break;
166  }
167  EXPECT_FALSE(reader.HasParseError());
168  }
169 }
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS. ...
Definition: reader.h:156
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
Definition: reader.h:680
Read-only string stream.
Definition: fwd.h:47
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
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
RAPIDJSON_FORCEINLINE bool IterativeParseComplete() const
Check if token-by-token parsing JSON text is complete.
Definition: reader.h:675
Here is the call graph for this function:

◆ TEST_F() [8/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParseIterativePullInsitu_DummyHandler)   
)

Definition at line 171 of file rapidjsontest.cpp.

171  {
172  for (size_t i = 0; i < kTrialCount; i++) {
173  memcpy(temp_, json_, length_ + 1);
174  InsituStringStream s(temp_);
176  Reader reader;
177  reader.IterativeParseInit();
178  while (!reader.IterativeParseComplete()) {
180  break;
181  }
182  EXPECT_FALSE(reader.HasParseError());
183  }
184 }
Default parse flags. Can be customized by defining RAPIDJSON_PARSE_DEFAULT_FLAGS. ...
Definition: reader.h:156
bool HasParseError() const
Whether a parse error has occurred in the last parsing.
Definition: reader.h:680
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
void * memcpy(void *a, const void *b, size_t c)
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
RAPIDJSON_FORCEINLINE bool IterativeParseComplete() const
Check if token-by-token parsing JSON text is complete.
Definition: reader.h:675
In-situ(destructive) parsing.
Definition: reader.h:147
Here is the call graph for this function:

◆ TEST_F() [9/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParse_DummyHandler_ValidateEncoding)   
)

Definition at line 186 of file rapidjsontest.cpp.

186  {
187  for (size_t i = 0; i < kTrialCount; i++) {
188  StringStream s(json_);
190  Reader reader;
192  }
193 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
Read-only string stream.
Definition: fwd.h:47
Validate encoding of JSON strings.
Definition: reader.h:148
Here is the call graph for this function:

◆ TEST_F() [10/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseInsitu_MemoryPoolAllocator)   
)

Definition at line 195 of file rapidjsontest.cpp.

195  {
196  for (size_t i = 0; i < kTrialCount; i++) {
197  memcpy(temp_, json_, length_ + 1);
198  Document doc;
199  doc.ParseInsitu(temp_);
200  ASSERT_TRUE(doc.IsObject());
201  }
202 }
GenericDocument & ParseInsitu(Ch *str)
Parse JSON text from a mutable string.
Definition: document.h:2308
void * memcpy(void *a, const void *b, size_t c)
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [11/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseIterativeInsitu_MemoryPoolAllocator)   
)

Definition at line 204 of file rapidjsontest.cpp.

204  {
205  for (size_t i = 0; i < kTrialCount; i++) {
206  memcpy(temp_, json_, length_ + 1);
207  Document doc;
208  doc.ParseInsitu<kParseIterativeFlag>(temp_);
209  ASSERT_TRUE(doc.IsObject());
210  }
211 }
Iterative(constant complexity in terms of function call stack size) parsing.
Definition: reader.h:149
GenericDocument & ParseInsitu(Ch *str)
Parse JSON text from a mutable string.
Definition: document.h:2308
void * memcpy(void *a, const void *b, size_t c)
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [12/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParse_MemoryPoolAllocator)   
)

Definition at line 213 of file rapidjsontest.cpp.

213  {
214  for (size_t i = 0; i < kTrialCount; i++) {
215  Document doc;
216  doc.Parse(json_);
217  ASSERT_TRUE(doc.IsObject());
218  }
219 }
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2331
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [13/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseLength_MemoryPoolAllocator)   
)

Definition at line 221 of file rapidjsontest.cpp.

221  {
222  for (size_t i = 0; i < kTrialCount; i++) {
223  Document doc;
224  doc.Parse(json_, length_);
225  ASSERT_TRUE(doc.IsObject());
226  }
227 }
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2331
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [14/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseStdString_MemoryPoolAllocator)   
)

Definition at line 230 of file rapidjsontest.cpp.

230  {
231  const std::string s(json_, length_);
232  for (size_t i = 0; i < kTrialCount; i++) {
233  Document doc;
234  doc.Parse(s);
235  ASSERT_TRUE(doc.IsObject());
236  }
237 }
::std::string string
Definition: gtest-port.h:1097
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2331
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [15/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseIterative_MemoryPoolAllocator)   
)

Definition at line 240 of file rapidjsontest.cpp.

240  {
241  for (size_t i = 0; i < kTrialCount; i++) {
242  Document doc;
243  doc.Parse<kParseIterativeFlag>(json_);
244  ASSERT_TRUE(doc.IsObject());
245  }
246 }
Iterative(constant complexity in terms of function call stack size) parsing.
Definition: reader.h:149
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2331
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Here is the call graph for this function:

◆ TEST_F() [16/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParse_CrtAllocator)   
)

Definition at line 248 of file rapidjsontest.cpp.

248  {
249  for (size_t i = 0; i < kTrialCount; i++) {
250  memcpy(temp_, json_, length_ + 1);
252  doc.Parse(temp_);
253  ASSERT_TRUE(doc.IsObject());
254  }
255 }
C-runtime library allocator.
Definition: allocators.h:75
GenericDocument & Parse(const typename SourceEncoding::Ch *str)
Parse JSON text from a read-only string (with Encoding conversion)
Definition: document.h:2331
void * memcpy(void *a, const void *b, size_t c)
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
A document for parsing JSON text as DOM.
Definition: document.h:60
Here is the call graph for this function:

◆ TEST_F() [17/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseEncodedInputStream_MemoryStream)   
)

Definition at line 257 of file rapidjsontest.cpp.

257  {
258  for (size_t i = 0; i < kTrialCount; i++) {
259  MemoryStream ms(json_, length_);
261  Document doc;
262  doc.ParseStream<0, UTF8<> >(is);
263  ASSERT_TRUE(doc.IsObject());
264  }
265 }
Represents an in-memory input byte stream.
Definition: memorystream.h:40
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
Input byte stream wrapper with a statically bound encoding.
Definition: encodedstream.h:39
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream (with Encoding conversion)
Definition: document.h:2265
UTF-8 encoding.
Definition: encodings.h:96
Here is the call graph for this function:

◆ TEST_F() [18/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(DocumentParseAutoUTFInputStream_MemoryStream)   
)

Definition at line 267 of file rapidjsontest.cpp.

267  {
268  for (size_t i = 0; i < kTrialCount; i++) {
269  MemoryStream ms(json_, length_);
271  Document doc;
272  doc.ParseStream<0, AutoUTF<unsigned> >(is);
273  ASSERT_TRUE(doc.IsObject());
274  }
275 }
Input stream wrapper with dynamically bound encoding and automatic encoding detection.
Represents an in-memory input byte stream.
Definition: memorystream.h:40
#define ASSERT_TRUE(condition)
Definition: gtest.h:1865
GenericDocument & ParseStream(InputStream &is)
Parse JSON text from an input stream (with Encoding conversion)
Definition: document.h:2265
Here is the call graph for this function:

◆ TEST_F() [19/31]

TEST_F ( RapidJson  ,
DocumentTraverse   
)

Definition at line 300 of file rapidjsontest.cpp.

300  {
301  for (size_t i = 0; i < kTrialCount; i++) {
302  size_t count = Traverse(doc_);
303  EXPECT_EQ(4339u, count);
304  //if (i == 0)
305  // std::cout << count << std::endl;
306  }
307 }
mdb_size_t count(MDB_cursor *cur)
size_t Traverse(const T &value)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
Here is the call graph for this function:

◆ TEST_F() [20/31]

TEST_F ( RapidJson  ,
DocumentAccept   
)

Definition at line 327 of file rapidjsontest.cpp.

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

◆ TEST_F() [21/31]

TEST_F ( RapidJson  ,
Writer_NullStream   
)

Definition at line 344 of file rapidjsontest.cpp.

344  {
345  for (size_t i = 0; i < kTrialCount; i++) {
346  NullStream s;
347  Writer<NullStream> writer(s);
348  doc_.Accept(writer);
349  //if (i == 0)
350  // std::cout << s.length_ << std::endl;
351  }
352 }
JSON writer.
Definition: fwd.h:95

◆ TEST_F() [22/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(Writer_StringBuffer)   
)

Definition at line 354 of file rapidjsontest.cpp.

354  {
355  for (size_t i = 0; i < kTrialCount; i++) {
356  StringBuffer s(0, 1024 * 1024);
357  Writer<StringBuffer> writer(s);
358  doc_.Accept(writer);
359  const char* str = s.GetString();
360  (void)str;
361  //if (i == 0)
362  // std::cout << strlen(str) << std::endl;
363  }
364 }
JSON writer.
Definition: fwd.h:95
Here is the call graph for this function:

◆ TEST_F() [23/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(PrettyWriter_StringBuffer)   
)

Definition at line 387 of file rapidjsontest.cpp.

387  {
388  for (size_t i = 0; i < kTrialCount; i++) {
389  StringBuffer s(0, 2048 * 1024);
390  PrettyWriter<StringBuffer> writer(s);
391  writer.SetIndent(' ', 1);
392  doc_.Accept(writer);
393  const char* str = s.GetString();
394  (void)str;
395  //if (i == 0)
396  // std::cout << strlen(str) << std::endl;
397  }
398 }
Writer with indentation and spacing.
Definition: fwd.h:100
Here is the call graph for this function:

◆ TEST_F() [24/31]

TEST_F ( RapidJson  ,
internal_Pow10   
)

Definition at line 400 of file rapidjsontest.cpp.

400  {
401  double sum = 0;
402  for (size_t i = 0; i < kTrialCount * kTrialCount; i++)
403  sum += internal::Pow10(int(i & 255));
404  EXPECT_GT(sum, 0.0);
405 }
#define EXPECT_GT(val1, val2)
Definition: gtest.h:1934
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() [25/31]

TEST_F ( RapidJson  ,
SkipWhitespace_Basic   
)

Definition at line 407 of file rapidjsontest.cpp.

407  {
408  for (size_t i = 0; i < kTrialCount; i++) {
409  rapidjson::StringStream s(whitespace_);
410  while (s.Peek() == ' ' || s.Peek() == '\n' || s.Peek() == '\r' || s.Peek() == '\t')
411  s.Take();
412  ASSERT_EQ('[', s.Peek());
413  }
414 }
GenericStringStream< UTF8< char > > StringStream
Definition: fwd.h:47
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956

◆ TEST_F() [26/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(SkipWhitespace  
)

Definition at line 416 of file rapidjsontest.cpp.

416  {
417  for (size_t i = 0; i < kTrialCount; i++) {
418  rapidjson::StringStream s(whitespace_);
420  ASSERT_EQ('[', s.Peek());
421  }
422 }
GenericStringStream< UTF8< char > > StringStream
Definition: fwd.h:47
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956
void SkipWhitespace(InputStream &is)
Skip the JSON white spaces in a stream.
Definition: reader.h:264
Here is the call graph for this function:

◆ TEST_F() [27/31]

TEST_F ( RapidJson  ,
SkipWhitespace_strspn   
)

Definition at line 424 of file rapidjsontest.cpp.

424  {
425  for (size_t i = 0; i < kTrialCount; i++) {
426  const char* s = whitespace_ + std::strspn(whitespace_, " \t\r\n");
427  ASSERT_EQ('[', *s);
428  }
429 }
#define ASSERT_EQ(val1, val2)
Definition: gtest.h:1956

◆ TEST_F() [28/31]

TEST_F ( RapidJson  ,
UTF8_Validate   
)

Definition at line 431 of file rapidjsontest.cpp.

431  {
432  NullStream os;
433 
434  for (size_t i = 0; i < kTrialCount; i++) {
435  StringStream is(json_);
436  bool result = true;
437  while (is.Peek() != '\0')
438  result &= UTF8<>::Validate(is, os);
439  EXPECT_TRUE(result);
440  }
441 }
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
Read-only string stream.
Definition: fwd.h:47
UTF-8 encoding.
Definition: encodings.h:96
Here is the call graph for this function:

◆ TEST_F() [29/31]

TEST_F ( RapidJson  ,
FileReadStream   
)

Definition at line 443 of file rapidjsontest.cpp.

443  {
444  for (size_t i = 0; i < kTrialCount; i++) {
445  FILE *fp = fopen(filename_, "rb");
446  char buffer[65536];
447  FileReadStream s(fp, buffer, sizeof(buffer));
448  while (s.Take() != '\0')
449  ;
450  fclose(fp);
451  }
452 }
File byte stream for input using fread().
Here is the call graph for this function:

◆ TEST_F() [30/31]

TEST_F ( RapidJson  ,
SIMD_SUFFIX(ReaderParse_DummyHandler_FileReadStream)   
)

Definition at line 454 of file rapidjsontest.cpp.

454  {
455  for (size_t i = 0; i < kTrialCount; i++) {
456  FILE *fp = fopen(filename_, "rb");
457  char buffer[65536];
458  FileReadStream s(fp, buffer, sizeof(buffer));
460  Reader reader;
461  reader.Parse(s, h);
462  fclose(fp);
463  }
464 }
ParseResult Parse(InputStream &is, Handler &handler)
Parse JSON text.
Definition: reader.h:557
File byte stream for input using fread().
Here is the call graph for this function:

◆ TEST_F() [31/31]

TEST_F ( RapidJson  ,
StringBuffer   
)

Definition at line 466 of file rapidjsontest.cpp.

466  {
467  StringBuffer sb;
468  for (int i = 0; i < 32 * 1024 * 1024; i++)
469  sb.Put(i & 0x7f);
470 }
Here is the call graph for this function:

◆ Traverse()

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

Definition at line 278 of file rapidjsontest.cpp.

278  {
279  size_t count = 1;
280  switch(value.GetType()) {
281  case kObjectType:
282  for (typename T::ConstMemberIterator itr = value.MemberBegin(); itr != value.MemberEnd(); ++itr) {
283  count++; // name
284  count += Traverse(itr->value);
285  }
286  break;
287 
288  case kArrayType:
289  for (typename T::ConstValueIterator itr = value.Begin(); itr != value.End(); ++itr)
290  count += Traverse(*itr);
291  break;
292 
293  default:
294  // Do nothing.
295  break;
296  }
297  return count;
298 }
object
Definition: rapidjson.h:624
array
Definition: rapidjson.h:625
mdb_size_t count(MDB_cursor *cur)
size_t Traverse(const T &value)
const GenericPointer< typename T::ValueType > T2 value
Definition: pointer.h:1225
Here is the call graph for this function:
Here is the caller graph for this function: