🚨 fix implicit conversion warning when opening binary file

This commit is contained in:
Niels Lohmann
2020-07-23 14:02:12 +02:00
parent fb22233f34
commit e571c67c0d
7 changed files with 52 additions and 70 deletions

View File

@@ -35,6 +35,7 @@ using nlohmann::json;
#include <fstream>
#include <sstream>
#include <test_data.hpp>
#include <test_utils.hpp>
TEST_CASE("BSON")
{
@@ -1263,10 +1264,7 @@ TEST_CASE("BSON roundtrips" * doctest::skip())
json j1 = json::parse(f_json);
// parse BSON file
std::ifstream f_bson(filename + ".bson", std::ios::binary);
std::vector<std::uint8_t> packed(
(std::istreambuf_iterator<char>(f_bson)),
std::istreambuf_iterator<char>());
auto packed = utils::read_binary_file(filename + ".bson");
json j2;
CHECK_NOTHROW(j2 = json::from_bson(packed));
@@ -1296,10 +1294,7 @@ TEST_CASE("BSON roundtrips" * doctest::skip())
json j1 = json::parse(f_json);
// parse BSON file
std::ifstream f_bson(filename + ".bson", std::ios::binary);
std::vector<std::uint8_t> packed(
(std::istreambuf_iterator<char>(f_bson)),
std::istreambuf_iterator<char>());
auto packed = utils::read_binary_file(filename + ".bson");
json j2;
CHECK_NOTHROW(j2 = json::from_bson({packed.data(), packed.size()}));
@@ -1314,10 +1309,7 @@ TEST_CASE("BSON roundtrips" * doctest::skip())
json j1 = json::parse(f_json);
// parse BSON file
std::ifstream f_bson(filename + ".bson", std::ios::binary);
std::vector<std::uint8_t> packed(
(std::istreambuf_iterator<char>(f_bson)),
std::istreambuf_iterator<char>());
auto packed = utils::read_binary_file(filename + ".bson");
{
INFO_WITH_TEMP(filename + ": output adapters: std::vector<std::uint8_t>");