summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBryan Bishop <kanzure@gmail.com>2013-09-21 23:14:58 -0500
committerBryan Bishop <kanzure@gmail.com>2013-09-21 23:14:58 -0500
commitf0e75972a119812ec37ec27fcdcd00afc45edf98 (patch)
treeb7ba1e7ec000d97273f1a662c53073e4adc35ed1 /tests
parent2a439694d6af7416732b76fe37e8ea9fe0e9faff (diff)
move tests into test_vba.py
They didn't belong in pokemontools/vba/vba.py in the first place.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_vba.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/test_vba.py b/tests/test_vba.py
index 56a71e3..12dd51b 100644
--- a/tests/test_vba.py
+++ b/tests/test_vba.py
@@ -102,5 +102,35 @@ class VbaTests(unittest.TestCase):
player_action = self.get_wram_value("PlayerAction")
self.assertEqual(player_action, 1) # 1 = standing
+class TestEmulator(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.cry = crystal()
+
+ # advance it forward past the intro sequences
+ cls.cry.vba.step(count=3500)
+
+ def test_PlaceString(self):
+ self.cry.call(0, 0x1078)
+
+ # where to draw the text
+ self.cry.registers["hl"] = 0xc4a0
+
+ # what text to read from
+ self.cry.registers["de"] = 0x1276
+
+ self.cry.vba.step(count=10)
+
+ text = self.cry.get_text()
+
+ self.assertTrue("TRAINER" in text)
+
+ def test_keyboard_planner(self):
+ button_sequence = keyboard.plan_typing("an")
+ expected_result = ["select", "a", "d", "r", "r", "r", "r", "a"]
+
+ self.assertEqual(len(expected_result), len(button_sequence))
+ self.assertEqual(expected_result, button_sequence)
+
if __name__ == "__main__":
unittest.main()