void FilesManager::createDecksReport() { readFromFile("decks.dat"); std::ofstream fileStream; fileStream.open("report.txt", std::ios::out | std::ios::app); if(fileStream) { Colors colors[] = { Red, Black, Blue, White, Green }; int decksSize = getDecksNumber(); for(int i = 0; i < COLORS_COUNT; i++) { fileStream << getColorName(matchColorByInteger(i)) << std::endl; for(int j = 0; j < decksSize; j++) { if(decks[j].getColor() == colors[i]) { fileStream << "Owner: " << getPlayerNameById(decks[j].getDeckOwnerId()) << " "; fileStream << "Card: " << decks[j].getCards()[0].getCardName() << " "; fileStream << "Color: " << decks[j].getCards()[0].getColor() << std::endl; } } } Card mostCommonCard = getMostCommonCardIdInAllDecks(); fileStream << "Most common card: " << mostCommonCard.getCardName() << " "; fileStream << "Color:" << mostCommonCard.getColor() << std::endl; } else { fileStream.clear(); fileStream.close(); throw serializable_exception; } }
bool operator==(const Card& lhs, const Card& rhs) { return lhs.getValue() == rhs.getValue() && lhs.getColor() == rhs.getColor(); }
TEST (CardTest, defaultValueOfColorAndFigureShouldBeNone ) { Card card; EXPECT_EQ (card.getColor(), Card_Color::None); EXPECT_EQ (card.getFigure(), Card_Figure::None); }