int main() { SubdividedSlimes s; SubdividedSlimes2 s2; int cnt = 0; for (;;) { ++ cnt; int S = rand() % 1000 + 2; int M = rand() % 1000 + 2; int r1 = s.needCut(S, M); int r2 = s2.needCut(S, M); if (r1 != r2) { cout << S << " " << M << " " << r1 << " " << r2 << endl; } if (cnt % 256 == 0) cerr << cnt << "\r" << flush; } }
bool do_test(int S, int M, int __expected) { time_t startClock = clock(); SubdividedSlimes *instance = new SubdividedSlimes(); int __result = instance->needCut(S, M); double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC; delete instance; if (__result == __expected) { cout << "PASSED!" << " (" << elapsed << " seconds)" << endl; return true; } else { cout << "FAILED!" << " (" << elapsed << " seconds)" << endl; cout << " Expected: " << to_string(__expected) << endl; cout << " Received: " << to_string(__result) << endl; return false; } }