示例#1
0
bool do_test(vector<string> S, int __expected) {
    time_t startClock = clock();
    AnagramFree *instance = new AnagramFree();
    int __result = instance->getMaximumSubset(S);
    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 testCase2() {
        string S_[] = {"aa", "aaaaa", "aaa", "a", "bbaaaa", "aaababaa"};
        vector<string> S(S_, S_ + (sizeof(S_) / sizeof(S_[0])));
		int expected_ = 6;
        assertEquals(2, expected_, solution.getMaximumSubset(S));
    }
示例#3
0
    void testCase3() {
        string S_[] = {"creation", "sentence", "reaction", "sneak", "star", "rats", "snake"};
        vector<string> S(S_, S_ + (sizeof(S_) / sizeof(S_[0])));
		int expected_ = 4;
        assertEquals(3, expected_, solution.getMaximumSubset(S));
    }
示例#4
0
    void testCase1() {
        string S_[] = {"abcd", "abac", "aabc", "bacd"};
        vector<string> S(S_, S_ + (sizeof(S_) / sizeof(S_[0])));
		int expected_ = 2;
        assertEquals(1, expected_, solution.getMaximumSubset(S));
    }