コード例 #1
0
int test53() {
    int width = 453;
    int height = 864;
    RectangularGrid* pObj = new RectangularGrid();
    clock_t start = clock();
    long long result = pObj->countRectangles(width, height);
    clock_t end = clock();
    delete pObj;
    long long expected = 38352535300;
    if(result == expected) {
        cout << "Test Case 53: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 53: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
コード例 #2
0
int test49() {
    int width = 964;
    int height = 999;
    RectangularGrid* pObj = new RectangularGrid();
    clock_t start = clock();
    long long result = pObj->countRectangles(width, height);
    clock_t end = clock();
    delete pObj;
    long long expected = 232017076860;
    if(result == expected) {
        cout << "Test Case 49: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 49: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
コード例 #3
0
int test38() {
    int width = 866;
    int height = 258;
    RectangularGrid* pObj = new RectangularGrid();
    clock_t start = clock();
    long long result = pObj->countRectangles(width, height);
    clock_t end = clock();
    delete pObj;
    long long expected = 12516785204;
    if(result == expected) {
        cout << "Test Case 38: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 38: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
コード例 #4
0
int test24() {
    int width = 537;
    int height = 786;
    RectangularGrid* pObj = new RectangularGrid();
    clock_t start = clock();
    long long result = pObj->countRectangles(width, height);
    clock_t end = clock();
    delete pObj;
    long long expected = 44590281701;
    if(result == expected) {
        cout << "Test Case 24: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 24: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
コード例 #5
0
int test15() {
    int width = 737;
    int height = 913;
    RectangularGrid* pObj = new RectangularGrid();
    clock_t start = clock();
    long long result = pObj->countRectangles(width, height);
    clock_t end = clock();
    delete pObj;
    long long expected = 113288367720;
    if(result == expected) {
        cout << "Test Case 15: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 15: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
コード例 #6
0
bool do_test(int width, int height, long long __expected) {
  time_t startClock = clock();
  RectangularGrid* instance = new RectangularGrid();
  long long __result = instance->countRectangles(width, height);
  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;
  }
}