| 114 | } |
| 115 | |
| 116 | int main(int argc, char **argv) |
| 117 | { |
| 118 | if (config().parseOptions(argc, argv)) |
| 119 | { |
| 120 | return EXIT_FAILURE; |
| 121 | } |
| 122 | |
| 123 | const std::vector<example_unicode> examples = { |
| 124 | {u8"£", {0xA3}}, |
| 125 | {u8"a", {0x61}}, |
| 126 | {u8"€", {0x20AC}}, |
| 127 | {u8"𐍈", {0x10348}}, |
| 128 | {u8"£a€𐍈", {0xA3, 0x61, 0x20AC, 0x10348}}, |
| 129 | }; |
| 130 | |
| 131 | for (const auto &ex : examples) |
| 132 | { |
| 133 | if (ex.test() != true) |
| 134 | return EXIT_FAILURE; |
| 135 | } |
| 136 | |
| 137 | UString example = u8"€UPpa91£B\"#ð𐍈"; |
| 138 | UString lower_example = u8"€uppa91£b\"#ð𐍈"; |
| 139 | UString upper_example = u8"€UPPA91£B\"#ð𐍈"; |
| 140 | |
| 141 | auto lower = to_lower(example); |
| 142 | auto upper = to_upper(example); |
| 143 | if (lower != lower_example) |
| 144 | { |
| 145 | LogError("toLower(\"%s\") returned \"%s\", expected \"%s\"", example, lower, lower_example); |
| 146 | return EXIT_FAILURE; |
| 147 | } |
| 148 | if (upper != upper_example) |
| 149 | { |
| 150 | LogError("toUpper(\"%s\") returned \"%s\", expected \"%s\"", example, upper, upper_example); |
| 151 | return EXIT_FAILURE; |
| 152 | } |
| 153 | |
| 154 | UString removed_example1 = u8"€UPpa91£\"#ð𐍈"; |
| 155 | UString removed_example2 = u8"€UPpa91£B\"#ð"; |
| 156 | UString removed_example3 = u8"UPpa91£B\"#ð𐍈"; |
| 157 | UString removed_example4 = u8"€UPpa91£𐍈"; |
| 158 | UString empty = u8""; |
| 159 | |
| 160 | if (!test_remove(example, removed_example1, 8, 1)) |
| 161 | return EXIT_FAILURE; |
| 162 | if (!test_remove(example, removed_example2, 12, 1)) |
| 163 | return EXIT_FAILURE; |
| 164 | if (!test_remove(example, removed_example2, 12, 10)) |
| 165 | return EXIT_FAILURE; |
| 166 | if (!test_remove(example, removed_example3, 0, 1)) |
| 167 | return EXIT_FAILURE; |
| 168 | if (!test_remove(example, removed_example4, 8, 4)) |
| 169 | return EXIT_FAILURE; |
| 170 | |
| 171 | bool exception_caught = false; |
| 172 | try |
| 173 | { |
nothing calls this directly
no test coverage detected