#include "testlib.h" #include using namespace std; const int MIN_N = 1; const int MAX_N = 1000; const int MIN_T = 1; const int MAX_T = 10000; const int MIN_NI = 1; const int MAX_NI = 100; const int rnd_test_n = 100; template void append(vector &dest, const vector &orig) { dest.insert(dest.end(), orig.begin(), orig.end()); } vector genRandomArray(int size = 0, int minv = MIN_NI, int maxv = MAX_NI) { if (size <= 0) size = rnd.next(MIN_N, MAX_N); vector arr(size); for (int i = 0; i < size; i++) { arr[i] = rnd.next(minv, maxv); } return arr; } string output_tc(int t, const vector& nums) { ostringstream oss; oss << nums.size() << " " << t << endl; for (int i = 0; i < nums.size(); i++) { if (i != 0) oss << " "; oss << nums[i]; } oss << endl; return oss.str(); } vector generate_sample_tests() { vector tests; tests.push_back(output_tc(10, {1, 2, 3, 4, 5})); tests.push_back(output_tc(4, {5, 1, 2, 5})); tests.push_back(output_tc(14, {1, 2, 3, 4, 4, 9, 9, 15})); return tests; } vector generate_manual_tests() { vector tests; tests.push_back(output_tc(1, {2,2,2,2,2,2,2,2})); tests.push_back(output_tc(2, {100, 100, 100, 3, 3, 3, 3, 3, 3, 2})); return tests; } string rnd_test(int i){ int min_n = MIN_N; int max_n = MAX_N; int min_t = MIN_T; int max_t = MAX_T; if(i generate_random_tests() { vector tests; for (int i = 0; i < rnd_test_n; i++){ tests.push_back(rnd_test(i)); } return tests; } string extreme_test_1(){ return(output_tc(MAX_T, genRandomArray(MAX_N))); } vector generate_extreme_tests(){ vector tests; tests.push_back(extreme_test_1()); return tests; } int main(int argc, char *argv[]) { registerGen(argc, argv, 1); vector tests; size_t test = 0; append(tests, generate_sample_tests()); append(tests, generate_manual_tests()); append(tests, generate_random_tests()); append(tests, generate_extreme_tests()); for (const auto &t : tests) { startTest(++test); cout << t; } return 0; }