bool do_test(int A, int B, int __expected, int caseNo) {

    time_t startClock = clock();
    TaroJiroDividing *instance = new TaroJiroDividing();
    int __result = instance->getNumber(A, B);
    double elapsed = (double)(clock() - startClock) / CLOCKS_PER_SEC;
    delete instance;

    if (__result == __expected) {
        cout << "  Testcase #" << caseNo << " ... ";
        cout << "PASSED!" << " (" << elapsed << " seconds)" << endl;
        return true;
    }
    else {
        cout << "  Testcase #" << caseNo << " ... ";
        cout << "FAILED!" << " (" << elapsed << " seconds)" << endl;
        cout << "           Expected: " << pretty_print(__expected) << endl;
        cout << "           Received: " << pretty_print(__result) << endl;
        return false;
    }
}
Example #2
0
int main( int argc, char* argv[] ) {
    {
        TaroJiroDividing theObject;
        eq(0, theObject.getNumber(8, 4),3);
    }
    {
        TaroJiroDividing theObject;
        eq(1, theObject.getNumber(4, 7),0);
    }
    {
        TaroJiroDividing theObject;
        eq(2, theObject.getNumber(12, 12),3);
    }
    {
        TaroJiroDividing theObject;
        eq(3, theObject.getNumber(24, 96),4);
    }
    {
        TaroJiroDividing theObject;
        eq(4, theObject.getNumber(1000000000, 999999999),0);
    }
	return 0;
}