MCPcopy Create free account
hub / github.com/Taywee/args / test_parse

Function test_parse

test/integer_parser.cxx:8–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6
7template <typename T>
8void test_parse(const std::string& input, bool expect_success, T expected_val) {
9 args::ValueReader reader;
10 T val = 0;
11 bool success = reader.ParseNumericValue(input, val);
12
13 if (success != expect_success) {
14 std::cerr << "FAIL (success mismatch): input='" << input
15 << "' success=" << success << " (expected " << expect_success << ")" << std::endl;
16 exit(1);
17 }
18
19 if (success && val != expected_val) {
20 std::cerr << "FAIL (value mismatch): input='" << input
21 << "' val=" << (long long)val << " (expected " << (long long)expected_val << ")" << std::endl;
22 exit(1);
23 }
24}
25
26int main() {
27 // Regression tests for C++17 from_chars compatibility

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected