<reponame>Whist-Team/Whist-Core
from tests.whist.core.team_base_test_case import TeamBaseTestCase
from whist.core.scoring.score import Score
from whist.core.scoring.score_card import ScoreCard


class ScoreCardTestCase(TeamBaseTestCase):
    def setUp(self) -> None:
        super().setUp()
        self.score_card = ScoreCard()

    def test_add_score(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        self.assertEqual(1, len(self.score_card))

    def test_draw(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        self.assertEqual(0, self.score_card.won(self.team_a))

    def test_max(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        self.assertEqual(2, self.score_card.max)

    def test_max_without_hand(self):
        self.assertEqual(0, self.score_card.max)

from tests.whist.core.team_base_test_case import TeamBaseTestCase
from whist.core.scoring.score import Score
from whist.core.scoring.score_card import ScoreCard


class ScoreCardTestCase(TeamBaseTestCase):
    def setUp(self) -> None:
        super().setUp()
        self.score_card = ScoreCard()

    def test_add_score(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        self.assertEqual(1, len(self.score_card))

    def test_draw(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        self.assertEqual(0, self.score_card.won(self.team_a))

    def test_max(self):
        score = Score([self.team_a, self.team_b], [7, 6])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        score = Score([self.team_a, self.team_b], [6, 7])
        self.score_card.add_score(score)
        self.assertEqual(2, self.score_card.max)

    def test_max_without_hand(self):
        self.assertEqual(0, self.score_card.max)