Esempio n. 1
0
int test15() {
    string keyboard = "tqrgnikvyxj";
    string word = "gjtynnynyviitjyikgxrgjivyir";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 103;
    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;
    }
}
Esempio n. 2
0
int test38() {
    string keyboard = "qdawxopznfimuvlsehrjytckbg";
    string word = "itgfggtzjopoqzyxfeamkyeqhiqmxbxpcrhxgcptcytnnxqcou";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 458;
    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;
    }
}
Esempio n. 3
0
int test40() {
    string keyboard = "xeplifckyhaodrmqzbuvwsjngt";
    string word = "yvvwzxkypuabekenotjttubcfjofciunddidotsaegnpzziyto";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 407;
    if(result == expected) {
        cout << "Test Case 40: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 40: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 4
0
int test35() {
    string keyboard = "xabuvlzychokmnpsdirqewftgj";
    string word = "imwrqmzipxtlvvmeqjovhwpeslpjbtwyoxrurxaahspdukeaei";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 438;
    if(result == expected) {
        cout << "Test Case 35: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 35: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 5
0
int test37() {
    string keyboard = "uwjseliorkqdtngfbamyvhzpxc";
    string word = "jnhtcg";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 52;
    if(result == expected) {
        cout << "Test Case 37: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 37: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 6
0
int test31() {
    string keyboard = "flcmhuzedpkatjwoigbxsvqnyr";
    string word = "ktvnnhiaasmqxfddocosnoshwn";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 213;
    if(result == expected) {
        cout << "Test Case 31: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 31: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 7
0
int test33() {
    string keyboard = "kdliovyxcuajrnpsmthbfqgezw";
    string word = "vlkbyzrjbuwslnoshdmxoumbngatishhqthviysyihxwjztnil";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 421;
    if(result == expected) {
        cout << "Test Case 33: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 33: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 8
0
int test21() {
    string keyboard = "sipndlwvyzcxtemkg";
    string word = "ntekzwvgxyewygenltgvmssvgmcnytcelcnvmdxexlnglypykw";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 275;
    if(result == expected) {
        cout << "Test Case 21: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 21: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 9
0
int test22() {
    string keyboard = "weiuosvgkhtbjdymrx";
    string word = "drbdetjgitumrduhhdwdshohxeehtyewjrytwy";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 239;
    if(result == expected) {
        cout << "Test Case 22: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 22: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 10
0
int test19() {
    string keyboard = "qilwphgasdcfvun";
    string word = "hcpflldugvslficifnvvwahcuqhiacpsgispvvvqdgwlavcwsp";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 259;
    if(result == expected) {
        cout << "Test Case 19: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 19: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 11
0
int test20() {
    string keyboard = "efsxwdybtivcpurk";
    string word = "yidkxkbifcvbbtpkfyyyrxvdpurcfssbepibcykyxwrwpcb";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 247;
    if(result == expected) {
        cout << "Test Case 20: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 20: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 12
0
int test18() {
    string keyboard = "izkldmubhqonrg";
    string word = "zzoimlbgrgdkhirdgdigbl";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 128;
    if(result == expected) {
        cout << "Test Case 18: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 18: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 13
0
int test17() {
    string keyboard = "kfsqvzpwbtmhg";
    string word = "qqphwmzzkbpmvbhggbfzpkwwbbfvwggkhkzwwvfvvmhpsspwtf";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 182;
    if(result == expected) {
        cout << "Test Case 17: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 17: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 14
0
int test16() {
    string keyboard = "cahvkibdmejt";
    string word = "vhejijvabvimajedbhtackvabvmkitjceatchtjbvtijbeckvi";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 226;
    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;
    }
}
Esempio n. 15
0
int test29() {
    string keyboard = "ijzqafksuobcmlypgthrdwnex";
    string word = "obyhorcajwymhsfotmhyqodtm";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 157;
    if(result == expected) {
        cout << "Test Case 29: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 29: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 16
0
int test23() {
    string keyboard = "uatspmolvizqnhryedg";
    string word = "vqgaahssnnmeepmuqevhdhovooqeezeqszinpvahooazganumt";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 296;
    if(result == expected) {
        cout << "Test Case 23: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 23: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 17
0
int test30() {
    string keyboard = "ljkhuogfrqwycvabszxptiendm";
    string word = "feiusvgkvwdocbciqktviclbsgvzdonuzmlktyybolrjxynilc";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 481;
    if(result == expected) {
        cout << "Test Case 30: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 30: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 18
0
int test24() {
    string keyboard = "phjafsgzoirxqevkcumy";
    string word = "earxykijjrcjcfryygucfh";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 152;
    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;
    }
}
Esempio n. 19
0
int test32() {
    string keyboard = "tfvpkgomeuyriqhjzwnaxscbdl";
    string word = "hkzdbfsouxxhkmxdfydgwqqyalosqxvykafgldxxgogejayqln";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 442;
    if(result == expected) {
        cout << "Test Case 32: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 32: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 20
0
int test25() {
    string keyboard = "zdpvagwsouileyjnfqrcm";
    string word = "alqnueweyiqsnszzczagdoiuquivpugrvenszjccicvqzrlnaa";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 352;
    if(result == expected) {
        cout << "Test Case 25: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 25: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 21
0
int test34() {
    string keyboard = "mxcqsfkpbawgzlrtdynheojiuv";
    string word = "ffpaceimfkarzthgjtevemdenvkuyvmkexzwcktluustvkersq";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 422;
    if(result == expected) {
        cout << "Test Case 34: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 34: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 22
0
int test26() {
    string keyboard = "damgreuvtjiqswkfxzopbc";
    string word = "tticddvdizidsfqjgmicwwqojjisofsrpvwggmzrazsfofpffs";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 294;
    if(result == expected) {
        cout << "Test Case 26: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 26: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 23
0
int test36() {
    string keyboard = "mwnruqchglsofaybitdvxejzkp";
    string word = "wwwfoirbrycfkvpstvtswsctykkqjotylrwrusfrpwxtulpuqz";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 412;
    if(result == expected) {
        cout << "Test Case 36: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 36: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 24
0
int test27() {
    string keyboard = "pnmjsqldkwfhoyxrzibvtug";
    string word = "mnkqjwbqbptdzinxzjrytrfuqvsvdqpskglxqbyrtixgqdkvfz";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 420;
    if(result == expected) {
        cout << "Test Case 27: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 27: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 25
0
int test2() {
    string keyboard = "qwertyuiopasdfghjklzxcvbnm";
    string word = "topcodersingleroundmatchgoodluckhavefun";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 322;
    if(result == expected) {
        cout << "Test Case 2: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 2: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 26
0
int test1() {
    string keyboard = "kwadrutove";
    string word = "rowerowe";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 39;
    if(result == expected) {
        cout << "Test Case 1: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 1: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 27
0
int test39() {
    string keyboard = "isyrwvdnlbqjzcthumaxgpkfeo";
    string word = "ukjokxadbbzhaoqxopvlhrsztgqeytezrg";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 268;
    if(result == expected) {
        cout << "Test Case 39: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 39: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 28
0
int test28() {
    string keyboard = "tfqvbawsdeuypcgxmirlokjz";
    string word = "zayapdleckjikgoflvwykzktkdpwsmrc";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 254;
    if(result == expected) {
        cout << "Test Case 28: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 28: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 29
0
int test41() {
    string keyboard = "pfxrlngakdjzcheyobmwsuivtq";
    string word = "rcdgbgkwet";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 65;
    if(result == expected) {
        cout << "Test Case 41: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 41: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}
Esempio n. 30
0
int test14() {
    string keyboard = "vhtgywqkem";
    string word = "wvkkvwqqtqetevqqmhqmvmythemmvhtmtwvkhqvvgegekmhkwy";
    TypingDistance* pObj = new TypingDistance();
    clock_t start = clock();
    int result = pObj->minDistance(keyboard, word);
    clock_t end = clock();
    delete pObj;
    int expected = 209;
    if(result == expected) {
        cout << "Test Case 14: Passed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 0;
    } else {
        cout << "Test Case 14: Failed! Time: " << static_cast<double>(end-start)/CLOCKS_PER_SEC << " seconds" << endl;
        return 1;
    }
}