int main(int argc, char **argv) { char word[MAX_LENGTH + 1], matchingWords[100][MAX_LENGTH + 1]; int numWords, count; DictionaryWord *words = readWordsFile(); MatchingWords *matchingWordsKey = readTesterFile(argv[1], &numWords); CPUTimer ct; Checker *checker = new Checker((const DictionaryWord*) words, NUM_WORDS); delete words; for(int i = 0; i < numWords; i++) { strcpy(word, matchingWordsKey[i].word); checker->findWord(word, matchingWords, &count); if(count != matchingWordsKey[i].count) { cout << "Incorrect count for trial# " << i << " for " << matchingWordsKey[i].word << " should be " << matchingWordsKey[i].count << " but received " << count << endl; } else // correct count { for(int j = 0; j < count; j++) if(strcmp(matchingWordsKey[i].matches[j], matchingWords[j]) != 0) { cout << "Words don't match for trial# " << i << " for " << matchingWordsKey[i].word << " match# " << j << " should be " << matchingWordsKey[i].matches[j] << " but received " << matchingWords[j] << endl; } // if invalid match } // else correct count } // for each word cout << "CPU Time: " << ct.cur_CPUTime() << endl; return 0; }