1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

add a test for ScorpionTail_RowStack.

A similar bug was fixed in Scorpion_RowStack.
This commit is contained in:
Shlomi Fish 2020-06-12 09:32:47 +03:00
parent 730ecf775b
commit d04601ad1c
2 changed files with 14 additions and 9 deletions

View file

@ -350,8 +350,8 @@ class Scorpion(RelaxedSpider):
class ScorpionTail_RowStack(Yukon_AC_RowStack, Spider_RowStack):
canMoveCards = OpenStack.canMoveCards
canDropCards = Spider_RowStack.canDropCards
canMoveCards = OpenStack.canMoveCards
class ScorpionTail(Scorpion):

View file

@ -7,6 +7,7 @@ from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon
import pysollib.stack
from pysollib.acard import AbstractCard
from pysollib.games.spider import Scorpion_RowStack, Spider_RowStack
from pysollib.games.spider import ScorpionTail_RowStack
class MockGame:
@ -41,9 +42,11 @@ class Mock_S_Game:
class MyTests(unittest.TestCase):
def _calc_Scorpion_stack(self):
def _calc_Scorpion_stack(self, isScorpionTail):
g = MockGame()
stack = Scorpion_RowStack(0, 0, g)
stack = (ScorpionTail_RowStack(0, 0, g)
if isScorpionTail
else Scorpion_RowStack(0, 0, g))
for s, r in [(2, 5), (3, 7), (2, 7), (2, 0), (2, 3), (2, 4), (1, 4)]:
c = AbstractCard(1000+r*100+s*10, 0, s, r, g)
c.face_up = True
@ -52,12 +55,14 @@ class MyTests(unittest.TestCase):
return stack
def test_canMoveCards(self):
stack = self._calc_Scorpion_stack()
for isScorpionTail in [False, True]:
stack = self._calc_Scorpion_stack(isScorpionTail)
stack.canMoveCards(stack.cards[6:])
self.assertTrue(stack)
def test_canMoveCards_non_top(self):
stack = self._calc_Scorpion_stack()
for isScorpionTail in [False, True]:
stack = self._calc_Scorpion_stack(isScorpionTail)
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
self.assertTrue(stack)