// BEGIN CUT HERE int main( int argc, char* argv[] ) { stderr=freopen("Scratch.txt", "w", stderr); fclose(stdout); stdout=stderr; { int retrunValueARRAY[] = { 3, 9 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); InterestingDigits theObject; eq(0, theObject.digits(10),retrunValue); } { int retrunValueARRAY[] = { 2 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); InterestingDigits theObject; eq(1, theObject.digits(3),retrunValue); } { int retrunValueARRAY[] = { 2, 4, 8 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); InterestingDigits theObject; eq(2, theObject.digits(9),retrunValue); } { int retrunValueARRAY[] = { 5, 25 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); InterestingDigits theObject; eq(3, theObject.digits(26),retrunValue); } { int retrunValueARRAY[] = { 29 }; vector <int> retrunValue( retrunValueARRAY, retrunValueARRAY+ARRSIZE(retrunValueARRAY) ); InterestingDigits theObject; eq(4, theObject.digits(30),retrunValue); } }
bool do_test(int base, vector<int> __expected) { time_t startClock = clock(); InterestingDigits *instance = new InterestingDigits(); vector<int> __result = instance->digits(base); 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; } }
void testCase4() { int base = 30; int expected__[] = {29}; vector<int> expected_(expected__, expected__ + (sizeof(expected__) / sizeof(expected__[0]))); assertEquals(4, expected_, solution.digits(base)); }
void testCase3() { int base = 26; int expected__[] = {5, 25}; vector<int> expected_(expected__, expected__ + (sizeof(expected__) / sizeof(expected__[0]))); assertEquals(3, expected_, solution.digits(base)); }
void testCase2() { int base = 9; int expected__[] = {2, 4, 8}; vector<int> expected_(expected__, expected__ + (sizeof(expected__) / sizeof(expected__[0]))); assertEquals(2, expected_, solution.digits(base)); }