92 lines
2.0 KiB
C++
92 lines
2.0 KiB
C++
#include "testlib.h"
|
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
const int MIN_N = 1;
|
|
const int MAX_N = 100;
|
|
|
|
const int rnd_test_n = 100;
|
|
|
|
template <typename T> void append(vector<T> &dest, const vector<T> &orig) {
|
|
dest.insert(dest.end(), orig.begin(), orig.end());
|
|
}
|
|
|
|
string output_tc(string s) {
|
|
ostringstream oss;
|
|
oss << s.size() << endl;
|
|
oss << s << endl;
|
|
return oss.str();
|
|
}
|
|
|
|
vector<string> generate_sample_tests() {
|
|
vector<string> tests;
|
|
tests.push_back(output_tc("12"));
|
|
tests.push_back(output_tc("226"));
|
|
tests.push_back(output_tc("06"));
|
|
return tests;
|
|
}
|
|
|
|
vector<string> generate_manual_tests() {
|
|
vector<string> tests;
|
|
tests.push_back(output_tc("101010101010"));
|
|
tests.push_back(output_tc("11111111111111111111"));
|
|
tests.push_back(output_tc("111111111111111111111111111111111111111111111"));
|
|
tests.push_back(output_tc("111111111111111111111000000000000000000000000"));
|
|
tests.push_back(output_tc("123456789"));
|
|
return tests;
|
|
}
|
|
|
|
string rnd_test(int i){
|
|
int min_n = MIN_N;
|
|
int max_n = MAX_N;
|
|
|
|
if(i<rnd_test_n / 3){
|
|
max_n = 25;
|
|
}
|
|
else if(i<rnd_test_n / 2){
|
|
max_n = 50;
|
|
}
|
|
|
|
int x = rnd.next(min_n, max_n);
|
|
|
|
return output_tc(rnd.next("[1-9]{" + to_string(x) + "}"));
|
|
}
|
|
|
|
vector<string> generate_random_tests() {
|
|
vector<string> 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(string(100, '1'));
|
|
}
|
|
|
|
string extreme_test_2(){
|
|
return output_tc(string(100, '0'));
|
|
}
|
|
|
|
vector<string> generate_extreme_tests(){
|
|
vector<string> tests;
|
|
tests.push_back(extreme_test_1());
|
|
tests.push_back(extreme_test_2());
|
|
return tests;
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
registerGen(argc, argv, 1);
|
|
vector<string> 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;
|
|
} |