#include #include "SuitT.h" using namespace std; void TestSuitString(SuitT suit, string word); int main() { SuitT s; int i; srand(static_cast(time(nullptr))); // can I step through all four. cout << "The suits are: " << endl; for(s = FIRST_SUIT; s != SuitT::NONE; s = NextSuit(s)) { cout << "\t" << SuitTToString(s) << endl; } cout << "Some random suits are: " << endl; for (i = 0; i < 10; i++) { cout << "\t" << SuitTToString(RandomSuit()) << endl; } cout << "Testing good words, there should be no error" << endl; TestSuitString(SuitT::HEART, "heart"); TestSuitString(SuitT::HEART, "Heart"); TestSuitString(SuitT::HEART, "HEart"); TestSuitString(SuitT::HEART, "HEART"); TestSuitString(SuitT::DIAMOND, "diamond"); TestSuitString(SuitT::DIAMOND, "DIAMOND"); TestSuitString(SuitT::CLUB, "CLUB"); TestSuitString(SuitT::CLUB, "Club"); TestSuitString(SuitT::CLUB, "club"); TestSuitString(SuitT::SPADE, "Spade"); TestSuitString(SuitT::SPADE, "spade"); TestSuitString(SuitT::SPADE, "SPADE"); cout << endl << endl; cout << "Testing bad words, there should be errors " << endl; TestSuitString(SuitT::HEART, "hearts"); TestSuitString(SuitT::SPADE, "heart"); TestSuitString(SuitT::DIAMOND, "heart"); TestSuitString(SuitT::CLUB, "heart"); return 0; } void TestSuitString(SuitT suit, string word){ SuitT newSuit; newSuit = StringToSuitT(word); if (newSuit != suit) { cout << "Error in TestSuitString: " << SuitTToString(suit) << " does not match " << word << endl; } return; }