diff options
Diffstat (limited to 'tests/test_vba_battle.py')
| -rw-r--r-- | tests/test_vba_battle.py | 51 | 
1 files changed, 51 insertions, 0 deletions
| diff --git a/tests/test_vba_battle.py b/tests/test_vba_battle.py new file mode 100644 index 0000000..6d3b504 --- /dev/null +++ b/tests/test_vba_battle.py @@ -0,0 +1,51 @@ +""" +Tests for the battle controller +""" + +import unittest + +from setup_vba import ( +    vba, +    autoplayer, +) + +from pokemontools.vba.battle import ( +    Battle, +    BattleException, +) + +from bootstrapping import ( +    bootstrap, +    bootstrap_trainer_battle, +) + +class BattleTests(unittest.TestCase): +    cry = None +    vba = None +    bootstrap_state = None + +    @classmethod +    def setUpClass(cls): +        cls.cry = vba.crystal() +        cls.vba = cls.cry.vba + +        cls.bootstrap_state = bootstrap_trainer_battle() +        cls.vba.state = cls.bootstrap_state + +    @classmethod +    def tearDownClass(cls): +        cls.vba.shutdown() + +    def setUp(self): +        # reset to whatever the bootstrapper created +        self.vba.state = self.bootstrap_state + +    def test_battle_is_player_turn(self): +        self.cry.vba.state = self.bootstrap_state + +        battle = Battle(emulator=self.cry) + +        self.assertTrue(battle.is_player_turn()) + +if __name__ == "__main__": +    unittest.main() | 
