diff options
| author | Bryan Bishop <kanzure@gmail.com> | 2012-03-24 05:00:45 -0500 | 
|---|---|---|
| committer | Bryan Bishop <kanzure@gmail.com> | 2012-03-24 05:00:45 -0500 | 
| commit | 0f5749915090b2d4055b9973ad6fa0d82ca5f040 (patch) | |
| tree | 8010fc09b913a4ebdb988c83f7684c29b388621e /extras | |
| parent | 9c723af8ffae03e7edbe18e6c084655fb4820f80 (diff) | |
tests for IntervalMap
Diffstat (limited to 'extras')
| -rw-r--r-- | extras/crystal.py | 36 | 
1 files changed, 33 insertions, 3 deletions
| diff --git a/extras/crystal.py b/extras/crystal.py index 40e52da0d..187df92ef 100644 --- a/extras/crystal.py +++ b/extras/crystal.py @@ -4501,6 +4501,35 @@ class TestCram(unittest.TestCase):          self.assertEqual(chars[0xA0], "a")          self.assertEqual(chars[0xF0], "¥")          self.assertEqual(jap_chars[0x44], "ぱ") +    def test_map_names_integrity(self): +        def map_name(map_group, map_id): return map_names[map_group][map_id]["name"] +        self.assertEqual(map_name(2, 7), "Mahogany Town") +        self.assertEqual(map_name(3, 0x34), "Ilex Forest") +        self.assertEqual(map_name(7, 0x11), "Cerulean City") +class TestIntervalMap(unittest.TestCase): +    def test_intervals(self): +        i = IntervalMap() +        first = "hello world" +        second = "testing 123" +        i[0:5] = first +        i[5:10] = second +        self.assertEqual(i[0], first) +        self.assertEqual(i[1], first) +        self.assertNotEqual(i[5], first) +        self.assertEqual(i[6], second) +        i[3:10] = second +        self.assertEqual(i[3], second) +        self.assertNotEqual(i[4], first) +    def test_items(self): +        i = IntervalMap() +        first = "hello world" +        second = "testing 123" +        i[0:5] = first +        i[5:10] = second +        results = list(i.items()) +        self.failUnless(len(results) == 2) +        self.assertEqual(results[0], ((0, 5), "hello world")) +        self.assertEqual(results[1], ((5, 10), "testing 123"))  class TestRomStr(unittest.TestCase):      """RomStr is a class that should act exactly like str()      except that it never shows the contents of it string @@ -4558,14 +4587,14 @@ class TestMapParsing(unittest.TestCase):          self.assertEqual(counter, 388)          parse_map_header_at = temp  class TestTextScript(unittest.TestCase): +    def test_to_asm(self): +        pass #or raise NotImplementedError, bryan_message      def test_find_addresses(self):          pass #or raise NotImplementedError, bryan_message      def test_parse_text_at(self):          pass #or raise NotImplementedError, bryan_message      def test_to_asm_at(self):          pass #or raise NotImplementedError, bryan_message -    def test_to_asm(self): -        pass #or raise NotImplementedError, bryan_message  class TestEncodedText(unittest.TestCase):      def test_to_asm(self):          pass #or raise NotImplementedError, bryan_message @@ -4579,7 +4608,8 @@ class TestScript(unittest.TestCase):      """for testing parse_script_engine_script_at      and script parsing in general.      Script should be a class?""" -    pass +    def test_parse_script_engine_script_at(self): +        pass #or raise NotImplementedError, bryan_message  class TestMetaTesting(unittest.TestCase):      """test whether or not i am finding at least      some of the tests in this file""" | 
