コード例 #1
0
ファイル: test_squareroom.py プロジェクト: tuturto/pyherc
    def setup(self):
        """
        Setup the test case
        """
        self.level = (
            LevelBuilder().with_size((20, 20)).with_floor_tile(self.floor_rock).with_wall_tile(self.wall_ground).build()
        )

        self.section = new_section((5, 5), (15, 15), self.level, self.rng)
        self.generator = SquareRoomGenerator(self.floor_rock, self.wall_empty, self.floor_rock, ["crypt"])
コード例 #2
0
    def setup(self):
        """
        Setup the test case
        """
        self.level = (LevelBuilder().with_size((20, 20)).with_floor_tile(
            self.floor_rock).with_wall_tile(self.wall_ground).build())

        self.section = new_section((5, 5), (15, 15), self.level, self.rng)
        self.generator = SquareRoomGenerator(self.floor_rock, self.wall_empty,
                                             self.floor_rock, ['crypt'])
コード例 #3
0
    def test_translating_to_section(self):
        """
        Test that Connection can be translated to section coordinates
        """
        level = LevelBuilder().build()
        section = new_section((10, 10), (20, 20), level, random.Random())

        connection = Connection(connection=None,
                                location=(20, 20),
                                direction="right",
                                section=section)

        translated_connection = connection.translate_to_section()

        assert_that(translated_connection.location, is_(equal_to((10, 10))))
コード例 #4
0
    def setup(self):
        """
        Setup the test case
        """
        self.floor_rock = 1
        self.wall_ground = 2

        self.level = (LevelBuilder()
                        .with_size((10, 10))
                        .with_floor_tile(self.floor_rock)
                        .with_wall_tile(self.wall_ground)
                        .build())

        self.rng = random.Random()
        self.section = new_section((0, 0),
                                   (10, 10),
                                   self.level,
                                   self.rng)
コード例 #5
0
    def test_translating_to_section(self):
        """
        Test that Connection can be translated to section coordinates
        """
        level = LevelBuilder().build()
        section = new_section((10, 10),
                              (20, 20),
                              level,
                              random.Random())

        connection = Connection(connection=None,
                                location=(20, 20),
                                direction="right",
                                section=section)

        translated_connection = connection.translate_to_section()

        assert_that(translated_connection.location, is_(equal_to((10, 10))))