Skip to content

Commit

Permalink
shuffle the fields in the large object test
Browse files Browse the repository at this point in the history
  • Loading branch information
chadaustin committed May 15, 2020
1 parent 2cff50e commit 93a7aa9
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions tests/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include <UnitTest++.h>

#include <random>

using sajson::document;
using sajson::literal;
using sajson::string;
Expand Down Expand Up @@ -756,10 +758,20 @@ SUITE(objects) {
}

ABSTRACT_TEST(get_value_large_object) {
std::string contents = "{";
unsigned values[1024];
for (unsigned i = 0; i < 1024; ++i) {
contents += (i ? ",\"" : "\"") + std::to_string(i)
+ "\":" + std::to_string(i);
values[i] = i;
}
std::random_device rd;
std::mt19937 g(rd());
std::shuffle(std::begin(values), std::end(values), g);

bool comma = false;
std::string contents = "{";
for (unsigned v : values) {
contents += (comma ? ",\"" : "\"") + std::to_string(v)
+ "\":" + std::to_string(v);
comma = true;
}
contents += "}";
const sajson::document& document
Expand Down

0 comments on commit 93a7aa9

Please sign in to comment.