MCPcopy Create free account
hub / github.com/audacity/audacity / TestFromChars

Function TestFromChars

libraries/lib-string-utils/tests/FromCharsTests.cpp:20–38  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19template <typename T>
20void 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
40TEMPLATE_TEST_CASE(
41 "FromChars/signed integers", "", short, int, long, long long)

Callers 1

FromCharsTests.cppFile · 0.85

Calls 3

FromCharsFunction · 0.85
dataMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected