diff --git a/tests/src/unit-deserialization.cpp b/tests/src/unit-deserialization.cpp index a7e98747e..ec94678c0 100644 --- a/tests/src/unit-deserialization.cpp +++ b/tests/src/unit-deserialization.cpp @@ -1428,6 +1428,18 @@ std::string outcome_of(Iterator first, Iterator last) } } +/// the bytes of @a text as a vector of @a T (explicit casts: no implicit char conversion) +template +std::vector bytes_as(const std::string& text) +{ + std::vector result; + for (const char c : text) + { + result.push_back(static_cast(c)); + } + return result; +} + /// a std::string, std::vector, and as /// iterator pairs: the same as the byte path (std::list iterators) void check_iterator_pairs(const std::string& text) @@ -1444,10 +1456,10 @@ void check_iterator_pairs(const std::string& text) const std::vector vc(text.begin(), text.end()); CHECK(outcome_of(vc.begin(), vc.end()) == expected); - const std::vector vu(text.begin(), text.end()); + const std::vector vu = bytes_as(text); CHECK(outcome_of(vu.begin(), vu.end()) == expected); CHECK(json::accept(vu.begin(), vu.end()) == expected_accept); - const std::vector vs(text.begin(), text.end()); + const std::vector vs = bytes_as(text); CHECK(outcome_of(vs.begin(), vs.end()) == expected); } } // namespace