예제 #1
0
bool do_test(string source, string __expected) {
    time_t startClock = clock();
    QuiningTopCoder *instance = new QuiningTopCoder();
    string __result = instance->testCode(source);
    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;
    }
}
예제 #2
0
 void testCase5() {
     string source = "#R,#:+1+:#,R#";
     string expected_ = "QUINES 97";
     assertEquals(5, expected_, solution.testCode(source));
 }
예제 #3
0
 void testCase6() {
     string source = "R,#1+1:";
     string expected_ = "MISMATCH 7";
     assertEquals(6, expected_, solution.testCode(source));
 }
예제 #4
0
 void testCase4() {
     string source = "0,1+::9W-9W-S1W1W:+2_J_@_@";
     string expected_ = "BADEND 437";
     assertEquals(4, expected_, solution.testCode(source));
 }
예제 #5
0
 void testCase3() {
     string source = "0,1+:#@:$1J";
     string expected_ = "QUINES 91";
     assertEquals(3, expected_, solution.testCode(source));
 }
예제 #6
0
 void testCase2() {
     string source = "1:+:1J";
     string expected_ = "OVERFLOW 147";
     assertEquals(2, expected_, solution.testCode(source));
 }
예제 #7
0
 void testCase1() {
     string source = "_";
     string expected_ = "TIMEOUT";
     assertEquals(1, expected_, solution.testCode(source));
 }
예제 #8
0
 void testCase0() {
     string source = ",";
     string expected_ = "QUINES 0";
     assertEquals(0, expected_, solution.testCode(source));
 }