Skip to content
Snippets Groups Projects
Commit b1722d19 authored by marlehmann's avatar marlehmann
Browse files

added getters to trick class. trick tests are finished but not all pass. will...

added getters to trick class. trick tests are finished but not all pass. will continue working on this
parent c901b290
No related branches found
No related tags found
2 merge requests!17finalize common,!16Draft: Resolve "write_common_tests"
......@@ -42,13 +42,15 @@ trick::~trick() {
int trick::get_trick_color() const {
return this->_trick_color->get_value();
}
std::vector<std::pair<card*, player*>> trick::get_cards() const
int trick::get_trump_color() const
{
return this->_trump_color->get_value();
}
std::vector<std::pair<card*, player*>> trick::get_cards_and_players() const
{
return this->_cards;
}
#ifdef WIZARD_SERVER
// determines winner using trump color
player* trick::wrap_up_trick(std::string& err) {
......@@ -138,7 +140,7 @@ void trick::set_trick_color(int color) {
//TODO write from json and to json
// for creating updated instance of trick
trick *trick::from_json(const rapidjson::Value &json) {
trick* trick::from_json(const rapidjson::Value &json) {
if (json.HasMember("id")
&& json.HasMember("cards")
&& json.HasMember("trump_color")
......
......@@ -22,23 +22,20 @@ private:
serializable_value<int>* _trump_color;
std::vector<std::pair<card*, player*>> _cards;
public:
trick();
explicit trick(std::string id);
trick(std::string id,
std::vector<std::pair<card*, player*>> &cards,
serializable_value<int>* trick_color,
serializable_value<int>* trump_color);
public:
trick();
explicit trick(int trump);
~trick();
// accessors
[[nodiscard]] int get_trick_color() const;
std::vector<std::pair<card*, player*>> get_cards() const;
[[nodiscard]] std::vector<std::pair<card*, player*>> get_cards_and_players() const;
[[nodiscard]] int get_trump_color() const;
#ifdef WIZARD_SERVER
// state update functions
......
project(Wizard-unit-tests)
set(TEST_SOURCE_FILES
card.cpp
deck.cpp
#card.cpp
# deck.cpp
# hand.cpp
player.cpp
# player.cpp
trick.cpp)
add_executable(Wizard-tests ${TEST_SOURCE_FILES})
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment