add a switch to enable implicit conversions (defaults to true)

wrap implicit conversions tests around the JSON_USE_IMPLICIT_CONVERSIONS
macro
This commit is contained in:
Théo DELRIEU
2020-07-16 11:11:35 +02:00
parent 2cd10a7405
commit 74b446f5fd
15 changed files with 151 additions and 64 deletions

View File

@@ -174,9 +174,9 @@ TEST_CASE("README" * doctest::skip())
}
// getter/setter
const std::string tmp = j[0];
const auto tmp = j[0].get<std::string>();
j[1] = 42;
bool foo = j.at(2);
bool foo{j.at(2)};
CHECK(foo == true);
// other stuff
@@ -258,18 +258,18 @@ TEST_CASE("README" * doctest::skip())
// strings
std::string s1 = "Hello, world!";
json js = s1;
std::string s2 = js;
auto s2 = js.get<std::string>();
// Booleans
bool b1 = true;
json jb = b1;
bool b2 = jb;
bool b2{jb};
CHECK(b2 == true);
// numbers
int i = 42;
json jn = i;
double f = jn;
double f{jn};
CHECK(f == 42);
// etc.