| 179 | } |
| 180 | |
| 181 | int UnityGetCommandLineOptions(int argc, const char* argv[]) |
| 182 | { |
| 183 | int i; |
| 184 | UnityFixture.Verbose = 0; |
| 185 | UnityFixture.Silent = 0; |
| 186 | UnityFixture.GroupFilter = 0; |
| 187 | UnityFixture.NameFilter = 0; |
| 188 | UnityFixture.RepeatCount = 1; |
| 189 | |
| 190 | if (argc == 1) |
| 191 | return 0; |
| 192 | |
| 193 | for (i = 1; i < argc; ) |
| 194 | { |
| 195 | if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) |
| 196 | { |
| 197 | /* Usage */ |
| 198 | UnityPrint("Runs a series of unit tests."); |
| 199 | UNITY_PRINT_EOL(); |
| 200 | UNITY_PRINT_EOL(); |
| 201 | UnityPrint("When no flag is specified, all tests are run."); |
| 202 | UNITY_PRINT_EOL(); |
| 203 | UNITY_PRINT_EOL(); |
| 204 | UnityPrint("Optional flags:"); |
| 205 | UNITY_PRINT_EOL(); |
| 206 | UnityPrint(" -v Verbose output: show all tests executed even if they pass"); |
| 207 | UNITY_PRINT_EOL(); |
| 208 | UnityPrint(" -s Silent mode: minimal output showing only test failures"); |
| 209 | UNITY_PRINT_EOL(); |
| 210 | UnityPrint(" -g NAME Only run tests in groups that contain the string NAME"); |
| 211 | UNITY_PRINT_EOL(); |
| 212 | UnityPrint(" -n NAME Only run tests whose name contains the string NAME"); |
| 213 | UNITY_PRINT_EOL(); |
| 214 | UnityPrint(" -r NUMBER Repeatedly run all tests NUMBER times"); |
| 215 | UNITY_PRINT_EOL(); |
| 216 | UnityPrint(" -h, --help Display this help message"); |
| 217 | UNITY_PRINT_EOL(); |
| 218 | UNITY_PRINT_EOL(); |
| 219 | #ifdef UNITY_CUSTOM_HELP_MSG |
| 220 | /* User-defined help message, e.g. to point to project-specific documentation */ |
| 221 | UnityPrint(UNITY_CUSTOM_HELP_MSG); |
| 222 | UNITY_PRINT_EOL(); |
| 223 | #else |
| 224 | /* Default help suffix if a custom one is not defined */ |
| 225 | UnityPrint("More information about Unity: https://www.throwtheswitch.org/unity"); |
| 226 | UNITY_PRINT_EOL(); |
| 227 | #endif |
| 228 | return 1; /* Exit without running the tests */ |
| 229 | } |
| 230 | else if (strcmp(argv[i], "-v") == 0) |
| 231 | { |
| 232 | UnityFixture.Verbose = 1; |
| 233 | i++; |
| 234 | } |
| 235 | else if (strcmp(argv[i], "-s") == 0) |
| 236 | { |
| 237 | UnityFixture.Silent = 1; |
| 238 | i++; |
no test coverage detected