Tests for Members in std::multimap.
This commit is contained in:
parent
71f0fa7eb3
commit
fc08f4f61b
BIN
bin/types/alotofkeys.json
Normal file
BIN
bin/types/alotofkeys.json
Normal file
Binary file not shown.
@ -130,7 +130,8 @@ public:
|
||||
"integers.json",
|
||||
"mixed.json",
|
||||
"nulls.json",
|
||||
"paragraphs.json"
|
||||
"paragraphs.json",
|
||||
"alotofkeys.json"
|
||||
};
|
||||
|
||||
for (size_t j = 0; j < sizeof(typesfilenames) / sizeof(typesfilenames[0]); j++) {
|
||||
@ -158,7 +159,7 @@ public:
|
||||
free(whitespace_);
|
||||
json_ = 0;
|
||||
whitespace_ = 0;
|
||||
for (size_t i = 0; i < 7; i++) {
|
||||
for (size_t i = 0; i < 8; i++) {
|
||||
free(types_[i]);
|
||||
types_[i] = 0;
|
||||
}
|
||||
@ -174,8 +175,8 @@ protected:
|
||||
size_t length_;
|
||||
char *whitespace_;
|
||||
size_t whitespace_length_;
|
||||
char *types_[7];
|
||||
size_t typesLength_[7];
|
||||
char *types_[8];
|
||||
size_t typesLength_[8];
|
||||
|
||||
static const size_t kTrialCount = 1000;
|
||||
};
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "rapidjson/memorystream.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#ifdef RAPIDJSON_SSE2
|
||||
#define SIMD_SUFFIX(name) name##_SSE2
|
||||
@ -52,7 +53,7 @@ public:
|
||||
// Parse as a document
|
||||
EXPECT_FALSE(doc_.Parse(json_).HasParseError());
|
||||
|
||||
for (size_t i = 0; i < 7; i++)
|
||||
for (size_t i = 0; i < 8; i++)
|
||||
EXPECT_FALSE(typesDoc_[i].Parse(types_[i]).HasParseError());
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ private:
|
||||
protected:
|
||||
char *temp_;
|
||||
Document doc_;
|
||||
Document typesDoc_[7];
|
||||
Document typesDoc_[8];
|
||||
};
|
||||
|
||||
TEST_F(RapidJson, SIMD_SUFFIX(ReaderParseInsitu_DummyHandler)) {
|
||||
@ -335,6 +336,23 @@ TEST_F(RapidJson, DocumentAccept) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_F(RapidJson, DocumentFind) {
|
||||
typedef Document::ValueType ValueType;
|
||||
typedef ValueType::ConstMemberIterator ConstMemberIterator;
|
||||
const Document &doc = typesDoc_[7]; // alotofkeys.json
|
||||
if (doc.IsObject()) {
|
||||
std::vector<const ValueType*> keys;
|
||||
for (ConstMemberIterator it = doc.MemberBegin(); it != doc.MemberEnd(); ++it) {
|
||||
keys.push_back(&it->name);
|
||||
}
|
||||
for (size_t i = 0; i < kTrialCount; i++) {
|
||||
for (size_t j = 0; j < keys.size(); j++) {
|
||||
EXPECT_TRUE(doc.FindMember(*keys[j]) != doc.MemberEnd());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct NullStream {
|
||||
typedef char Ch;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user