int main(int argc, const char *argv[]) { const char *retmsg = ""; const char *svc = ""; const char *test_nums = ""; int retval = 1; int live = 0; int i; for (i=1; i < argc; ++i) { if (strcmp(argv[i], "-f") == 0 && i < argc-1) { ++i; s_json_file = argv[i]; } else if (strcmp(argv[i], "-l") == 0) { live = 1; } else if (strcmp(argv[i], "-n") == 0 && i < argc-1) { ++i; test_nums = argv[i]; retmsg = "Not all tests run."; } else if (strcmp(argv[i], "-s") == 0 && i < argc-1) { ++i; svc = argv[i]; retmsg = "Run for a given service instead of standard tests."; } else if (strcmp(argv[i], "-u") == 0 && i < argc-1) { ++i; s_user_header = argv[i]; retmsg = "User header overridden."; } else { fprintf(stderr, "USAGE: %s [OPTIONS...]\n", argv[0]); fprintf(stderr, " [-h] help\n" " [-f ARG] test file\n" " [-l] live test data (default is mock data)\n" " [-n ARG] comma-separated test selections (eg 1,2,5)\n" " [-s ARG] service\n" " [-u ARG] user header\n"); goto out; } } CORE_SetLOGFormatFlags(fLOG_None | fLOG_Level | fLOG_OmitNoteLevel); CORE_SetLOGFILE(stderr, 0/*false*/); if (*svc) { test_service(live, svc); } else { if ( ! run_tests(live, test_nums) && ! *retmsg) retmsg = "Not all tests passed."; } out: CORE_LOG(eLOG_Note, ""); if (strcmp(retmsg, "") == 0) { /* The only successful condition is a run of all tests. */ CORE_LOG(eLOG_Note, "SUCCESS - All tests passed."); retval = 0; } else { CORE_LOGF(eLOG_Note, ("FAIL - %s", retmsg)); } CORE_SetLOG(0); return retval; }
int _tmain(int argc, _TCHAR* argv[]) { test_service(); ::system("pause"); return 0; }
int main(int argc, char* argv[]) { TestService test_service(argc, argv); return test_service.Execute(); }