コード例 #1
0
bool do_test(string s, int K, string __expected) {
    time_t startClock = clock();
    Decipherability *instance = new Decipherability();
    string __result = instance->check(s, K);
    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
int main( int argc, char* argv[] ) {
    {
        Decipherability theObject;
        eq(0, theObject.check("snuke", 2),"Certain");
    }
    {
        Decipherability theObject;
        eq(1, theObject.check("aba", 1),"Certain");
    }
    {
        Decipherability theObject;
        eq(2, theObject.check("aba", 2),"Uncertain");
    }
    {
        Decipherability theObject;
        eq(3, theObject.check("abcdabcd", 3),"Certain");
    }
    {
        Decipherability theObject;
        eq(4, theObject.check("koukyoukoukokukikou", 2),"Uncertain");
    }
    {
        Decipherability theObject;
        eq(5, theObject.check("wolfsothe", 8),"Uncertain");
    }
    {
        Decipherability theObject;
        eq(6, theObject.check("aa", 2),"Certain");
    }
	return 0;
}