void testCase4() { int numLength = 18; vector<string> forbidden; int allowed = 1; int expected_ = 262144; assertEquals(4, expected_, solution.howMany(numLength, forbidden, allowed)); }
void testCase5() { int numLength = 18; string forbidden_[] = {"c", "cc", "ccc", "cccc", "ccccc", "cccccc", "ccccccc", "cccccccc", "ccccccccc", "cccccccccc"}; vector<string> forbidden(forbidden_, forbidden_ + (sizeof(forbidden_) / sizeof(forbidden_[0]))); int allowed = 100; int expected_ = 262122; assertEquals(5, expected_, solution.howMany(numLength, forbidden, allowed)); }
void testCase2() { int numLength = 10; string forbidden_[] = {"c"}; vector<string> forbidden(forbidden_, forbidden_ + (sizeof(forbidden_) / sizeof(forbidden_[0]))); int allowed = 2; int expected_ = 11; assertEquals(2, expected_, solution.howMany(numLength, forbidden, allowed)); }
void testCase0() { int numLength = 3; string forbidden_[] = {"cc", "dd"}; vector<string> forbidden(forbidden_, forbidden_ + (sizeof(forbidden_) / sizeof(forbidden_[0]))); int allowed = 1; int expected_ = 2; assertEquals(0, expected_, solution.howMany(numLength, forbidden, allowed)); }
bool KawigiEdit_RunTest(int testNum, int p0, vector <string> p1, int p2, bool hasAnswer, int p3) { cout << "Test " << testNum << ": [" << p0 << "," << "{"; for (int i = 0; int(p1.size()) > i; ++i) { if (i > 0) { cout << ","; } cout << "\"" << p1[i] << "\""; } cout << "}" << "," << p2; cout << "]" << endl; TennisRallies *obj; int answer; obj = new TennisRallies(); clock_t startTime = clock(); answer = obj->howMany(p0, p1, p2); clock_t endTime = clock(); delete obj; bool res; res = true; cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl; if (hasAnswer) { cout << "Desired answer:" << endl; cout << "\t" << p3 << endl; } cout << "Your answer:" << endl; cout << "\t" << answer << endl; if (hasAnswer) { res = answer == p3; } if (!res) { cout << "DOESN'T MATCH!!!!" << endl; } else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) { cout << "FAIL the timeout" << endl; res = false; } else if (hasAnswer) { cout << "Match :-)" << endl; } else { cout << "OK, but is it right?" << endl; } cout << "" << endl; return res; }