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:
parent
730ecf775b
commit
d04601ad1c
2 changed files with 14 additions and 9 deletions
|
@ -350,8 +350,8 @@ class Scorpion(RelaxedSpider):
|
||||||
|
|
||||||
|
|
||||||
class ScorpionTail_RowStack(Yukon_AC_RowStack, Spider_RowStack):
|
class ScorpionTail_RowStack(Yukon_AC_RowStack, Spider_RowStack):
|
||||||
canMoveCards = OpenStack.canMoveCards
|
|
||||||
canDropCards = Spider_RowStack.canDropCards
|
canDropCards = Spider_RowStack.canDropCards
|
||||||
|
canMoveCards = OpenStack.canMoveCards
|
||||||
|
|
||||||
|
|
||||||
class ScorpionTail(Scorpion):
|
class ScorpionTail(Scorpion):
|
||||||
|
|
|
@ -7,6 +7,7 @@ from pysol_tests.common_mocks1 import MockApp, MockCanvas, MockItem, MockTalon
|
||||||
import pysollib.stack
|
import pysollib.stack
|
||||||
from pysollib.acard import AbstractCard
|
from pysollib.acard import AbstractCard
|
||||||
from pysollib.games.spider import Scorpion_RowStack, Spider_RowStack
|
from pysollib.games.spider import Scorpion_RowStack, Spider_RowStack
|
||||||
|
from pysollib.games.spider import ScorpionTail_RowStack
|
||||||
|
|
||||||
|
|
||||||
class MockGame:
|
class MockGame:
|
||||||
|
@ -41,9 +42,11 @@ class Mock_S_Game:
|
||||||
|
|
||||||
|
|
||||||
class MyTests(unittest.TestCase):
|
class MyTests(unittest.TestCase):
|
||||||
def _calc_Scorpion_stack(self):
|
def _calc_Scorpion_stack(self, isScorpionTail):
|
||||||
g = MockGame()
|
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)]:
|
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 = AbstractCard(1000+r*100+s*10, 0, s, r, g)
|
||||||
c.face_up = True
|
c.face_up = True
|
||||||
|
@ -52,14 +55,16 @@ class MyTests(unittest.TestCase):
|
||||||
return stack
|
return stack
|
||||||
|
|
||||||
def test_canMoveCards(self):
|
def test_canMoveCards(self):
|
||||||
stack = self._calc_Scorpion_stack()
|
for isScorpionTail in [False, True]:
|
||||||
stack.canMoveCards(stack.cards[6:])
|
stack = self._calc_Scorpion_stack(isScorpionTail)
|
||||||
self.assertTrue(stack)
|
stack.canMoveCards(stack.cards[6:])
|
||||||
|
self.assertTrue(stack)
|
||||||
|
|
||||||
def test_canMoveCards_non_top(self):
|
def test_canMoveCards_non_top(self):
|
||||||
stack = self._calc_Scorpion_stack()
|
for isScorpionTail in [False, True]:
|
||||||
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
|
stack = self._calc_Scorpion_stack(isScorpionTail)
|
||||||
self.assertTrue(stack)
|
self.assertTrue(stack.canMoveCards(stack.cards[4:]))
|
||||||
|
self.assertTrue(stack)
|
||||||
|
|
||||||
def _calc_Spider_stack(self):
|
def _calc_Spider_stack(self):
|
||||||
g = MockGame()
|
g = MockGame()
|
||||||
|
|
Loading…
Add table
Reference in a new issue