| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include <algorithm> | ||
| 2 | #include <cstdlib> | ||
| 3 | #include <cstring> | ||
| 4 | #include <iostream> | ||
| 5 | #include <text_conversion_constexpr.h> | ||
| 6 | #include <vector> | ||
| 7 | |||
| 8 | namespace | ||
| 9 | { | ||
| 10 | 1 | void process(const char* input) | |
| 11 | { | ||
| 12 | 1 | const auto size = std::strlen(input); | |
| 13 | |||
| 14 | 1 | std::vector<char> data; | |
| 15 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | data.resize(size + 1); |
| 16 | |||
| 17 |
1/2✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | std::copy(input, input + size, data.begin()); |
| 18 | |||
| 19 | 1 | text_conversion_constexpr::convert_to_title_case(data); | |
| 20 | |||
| 21 | // null terminated string | ||
| 22 | 1 | data[size] = 0; | |
| 23 | |||
| 24 |
2/4✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
|
1 | std::cout << data.data() << std::endl; |
| 25 | 1 | } | |
| 26 | } // namespace | ||
| 27 | |||
| 28 | 2 | int main(int argc, char* argv[]) | |
| 29 | { | ||
| 30 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | if (argc != 2) |
| 31 | { | ||
| 32 | 1 | std::cerr << "Invalid command line arguments. Expected a single input string." << std::endl; | |
| 33 | 1 | return EXIT_FAILURE; | |
| 34 | } | ||
| 35 | |||
| 36 | 1 | process(argv[1]); | |
| 37 | |||
| 38 | 1 | return EXIT_SUCCESS; | |
| 39 | } | ||
| 40 |