Example #1
0
    def test_deserialize(self, w=4, h=4, offset=2, tiles='   abcdefgh'):
        print(f"TESTING 'deserialize()'")
        gmap = GameMap()
        gmap.load_tiles(w, h, offset, tiles)
        print("    ORIGINAL:")
        self.print_map(gmap, indent='        ')
        serial = gmap.serialize()
        print(f"    SERIAL VERSION: {str(serial)}")
        new_gmap = GameMap()
        new_gmap.deserialize(serial)
        self.print_map(new_gmap, indent='        ')

        if gmap.tiles == new_gmap.tiles:
            print("    SUCCESS! Maps match.")
        else:
            print("    FAILURE... Maps do not match.")
Example #2
0
 def test_serialize(self, w=4, h=4, offset=2, tiles='   abcdefgh'):
     print(f"TESTING 'serialize()'")
     gmap = GameMap()
     gmap.load_tiles(w, h, offset, tiles)
     print('   ', gmap.serialize())
     print()