| 6 | #include <string> |
| 7 | |
| 8 | std::string generateWorstCaseRequest(unsigned num_coordinates) |
| 9 | { |
| 10 | if (num_coordinates == 0) |
| 11 | return "/table/v1/driving/"; |
| 12 | |
| 13 | std::string request; |
| 14 | request.reserve(50 * num_coordinates); |
| 15 | request += "/table/v1/driving/"; |
| 16 | |
| 17 | // 1. Coordinates: (2-3 (major) + 1 (dot) + 6 (decimals)) * 2 = 20 chars per coordinate |
| 18 | for (unsigned i = 0; i < num_coordinates; ++i) |
| 19 | { |
| 20 | request += "179.123456,89.123456"; |
| 21 | if (i < num_coordinates - 1) |
| 22 | request += ";"; |
| 23 | } |
| 24 | |
| 25 | request += "?"; |
| 26 | |
| 27 | // 2. Radiuses: 3 digits |
| 28 | request += "radiuses="; |
| 29 | for (unsigned i = 0; i < num_coordinates; ++i) |
| 30 | { |
| 31 | request += "999"; |
| 32 | if (i < num_coordinates - 1) |
| 33 | request += ";"; |
| 34 | } |
| 35 | request += "&"; |
| 36 | |
| 37 | // 3. Sources and Destinations: 4 digits |
| 38 | std::string sources_str = "sources="; |
| 39 | std::string destinations_str = "destinations="; |
| 40 | std::string index_str = ""; |
| 41 | for (unsigned i = 0; i < num_coordinates; ++i) |
| 42 | { |
| 43 | index_str += "9999"; |
| 44 | if (i < num_coordinates - 1) |
| 45 | { |
| 46 | index_str += ";"; |
| 47 | } |
| 48 | } |
| 49 | request += sources_str + index_str + "&" + destinations_str + index_str + "&"; |
| 50 | |
| 51 | // 4. Approaches: "unrestricted" has 12 chars |
| 52 | request += "approaches="; |
| 53 | for (unsigned i = 0; i < num_coordinates; ++i) |
| 54 | { |
| 55 | request += "unrestricted"; |
| 56 | if (i < num_coordinates - 1) |
| 57 | request += ";"; |
| 58 | } |
| 59 | |
| 60 | return request; |
| 61 | } |
| 62 | |
| 63 | BOOST_AUTO_TEST_SUITE(header_size) |
| 64 |
no test coverage detected