Ejemplo n.º 1
0
int test16() {
    int numRed = 87;
    int numBlue = 16;
    int onlyRed = 969;
    int onlyBlue = -997;
    int bothColors = 549;
    ColorfulBoxesAndBalls* pObj = new ColorfulBoxesAndBalls();
    clock_t start = clock();
    int result = pObj->getMaximum(numRed, numBlue, onlyRed, onlyBlue, bothColors);
    clock_t end = clock();
    delete pObj;
    int expected = 86367;
    if(result == expected) {
        cout << "Test Case 16: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 16: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Ejemplo n.º 2
0
int test13() {
    int numRed = 98;
    int numBlue = 26;
    int onlyRed = 944;
    int onlyBlue = 565;
    int bothColors = 126;
    ColorfulBoxesAndBalls* pObj = new ColorfulBoxesAndBalls();
    clock_t start = clock();
    int result = pObj->getMaximum(numRed, numBlue, onlyRed, onlyBlue, bothColors);
    clock_t end = clock();
    delete pObj;
    int expected = 107202;
    if(result == expected) {
        cout << "Test Case 13: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 13: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}