| 170 | |
| 171 | const std::string fetchURL = "www.example.com"; |
| 172 | int |
| 173 | main(int argc, char **argv) |
| 174 | { |
| 175 | // Simulate the scenario |
| 176 | FailureData data; |
| 177 | int noOfAttempt = 0, noOfExcept = 0; |
| 178 | |
| 179 | int count = atoi(argv[1]); |
| 180 | while (count--) { |
| 181 | int decision = rand() % 100; |
| 182 | |
| 183 | if (isAttemptReq(fetchURL, data)) { |
| 184 | noOfAttempt++; |
| 185 | if (decision >= atoi(argv[2]) && 0) |
| 186 | registerSuccFail(fetchURL, data, true); |
| 187 | |
| 188 | else |
| 189 | registerSuccFail(fetchURL, data, false); |
| 190 | } else |
| 191 | noOfExcept++; |
| 192 | } |
| 193 | |
| 194 | cout << " SERVED FROM ATTEMPT " << noOfAttempt << " TOTAL " << atoi(argv[1]) << endl; |
| 195 | cout << " SERVED FROM EXCEPT " << noOfExcept << " TOTAL " << atoi(argv[1]) << endl; |
| 196 | } |
nothing calls this directly
no test coverage detected