# Path: cuwo/static.py
# class StaticEntityHeader(WrapStaticEntityHeader):
#     def is_dynamic(self):
#         return self.get_type() in DYNAMIC_ENTITIES
# 
#     def get_type(self):
#         return strings.STATIC_NAMES[self.entity_type]
# 
#     def set_type(self, name):
#         self.entity_type = strings.STATIC_IDS[name]


import unittest
import sys
import os
import zlib
import subprocess
from cuwo import tgen
from cuwo.bytes import ByteReader
from cuwo.static import StaticEntityHeader

    def test_static_entities(self):
        with open('./tests/tgen_static.dat', 'rb') as fp:
            data = zlib.decompress(fp.read())

        reader = ByteReader(data)
        source = []
        while reader.get_left() > 0:
            entity = StaticEntityHeader()
            entity.read(reader)
            source.append(entity)

        chunk = tgen.generate(32803, 32803)

        self.assertEqual(len(chunk.static_entities), len(source))

        for index, entity in enumerate(chunk.static_entities):
            header1 = entity.header
            header2 = source[index]
            self.assertEqual(header1.entity_type, header2.entity_type)
            self.assertEqual(header1.pos, header2.pos)
            self.assertEqual(header1.orientation, header2.orientation)
            self.assertEqual(header1.size, header2.size)
            self.assertEqual(header1.closed, header2.closed)
            self.assertEqual(header1.time_offset, header2.time_offset)
            self.assertEqual(header1.something8, header2.something8)
            self.assertEqual(header1.user_id, header2.user_id)

        events = [
            ('generate', (1007, 4974)),

# Path: cuwo/static.py
# class StaticEntityHeader(WrapStaticEntityHeader):
#     def is_dynamic(self):
#         return self.get_type() in DYNAMIC_ENTITIES
# 
#     def get_type(self):
#         return strings.STATIC_NAMES[self.entity_type]
# 
#     def set_type(self, name):
#         self.entity_type = strings.STATIC_IDS[name]


# Path: tests/test_tgen.py
import unittest
import sys
import os
import zlib
import subprocess
from cuwo import tgen
from cuwo.bytes import ByteReader
from cuwo.static import StaticEntityHeader


    def test_static_entities(self):
        with open('./tests/tgen_static.dat', 'rb') as fp:
            data = zlib.decompress(fp.read())

        reader = ByteReader(data)
        source = []
        while reader.get_left() > 0:
            entity = StaticEntityHeader()
            entity.read(reader)
            source.append(entity)

        chunk = tgen.generate(32803, 32803)

        self.assertEqual(len(chunk.static_entities), len(source))

        for index, entity in enumerate(chunk.static_entities):
            header1 = entity.header
            header2 = source[index]
            self.assertEqual(header1.entity_type, header2.entity_type)
            self.assertEqual(header1.pos, header2.pos)
            self.assertEqual(header1.orientation, header2.orientation)
            self.assertEqual(header1.size, header2.size)
            self.assertEqual(header1.closed, header2.closed)
            self.assertEqual(header1.time_offset, header2.time_offset)
            self.assertEqual(header1.something8, header2.something8)
            self.assertEqual(header1.user_id, header2.user_id)

        events = [
            ('generate', (1007, 4974)),

            ('generate', (1007, 4973)),