bool do_test(int N, int __expected) {
    time_t startClock = clock();
    LockersDivOne *instance = new LockersDivOne();
    int __result = instance->lastOpened(N);
    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;
    }
}
Beispiel #2
0
int main(int argc, char* argv[])
{
      {
        LockersDivOne theObject;
        eq(0, theObject.lastOpened(9),6);
    }
    {
        LockersDivOne theObject;
        eq(1, theObject.lastOpened(42),42);
    }
    {
        LockersDivOne theObject;
        eq(2, theObject.lastOpened(314),282);
    }
    {
        LockersDivOne theObject;
        eq(2, theObject.lastOpened(2000000),282);
    }

}