| 18 | |
| 19 | template <typename T> |
| 20 | void TestFromChars(std::string_view input, T expectedValue, std::errc errc = {}) |
| 21 | { |
| 22 | T value; |
| 23 | |
| 24 | const auto result = |
| 25 | FromChars(input.data(), input.data() + input.length(), value); |
| 26 | |
| 27 | REQUIRE(errc == result.ec); |
| 28 | |
| 29 | if (errc == std::errc {}) |
| 30 | { |
| 31 | if constexpr (std::is_floating_point_v<std::decay_t<T>>) |
| 32 | REQUIRE(Approx(expectedValue) == value); |
| 33 | else |
| 34 | REQUIRE(expectedValue == value); |
| 35 | |
| 36 | REQUIRE(result.ptr == input.data() + input.length()); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | TEMPLATE_TEST_CASE( |
| 41 | "FromChars/signed integers", "", short, int, long, long long) |
no test coverage detected