示例#1
0
    def test_from_link_list_nonterminals(self):
        left = Link(x=10, y=20, c_flag=5)
        right = Link(x=34, y=66, c_flag=5)
        expected = Event(sx=10, sy=20, ex=34, ey=66, c_flag=5)
        result = list(Event.from_links([left, right]))

        count = 0
        for ev in result:
            count += 1
            self.assertTrue(expected == result[0])
        self.assertEqual(1, count)
示例#2
0
    def test_from_link_list_three(self):
        first = Link(x=10, y=20, c_flag=5)
        second = Link(x=34, y=66, c_flag=5)
        third = Link(x=55, y=96, c_flag=5)
        expected_first = Event(sx=10, sy=20, ex=34, ey=66, c_flag=5)
        expected_second = Event(sx=34, sy=66, ex=55, ey=96, c_flag=5)
        result = list(Event.from_links([first, second, third]))

        count = 0
        for ev in result:
            count += 1
        self.assertEqual(2, count)
        self.assertTrue(expected_first == result[0])
        self.assertTrue(expected_second == result[1])
示例#3
0
    def test_from_link_list_four_terminal_second(self):
        first = Link(x=10, y=20, c_flag=5)
        second = Link(x=34, y=66, c_flag=255)
        third = Link(x=55, y=96, c_flag=6)
        fourth = Link(x=72, y=61, c_flag=6)
        expected_first = Event(sx=10, sy=20, ex=34, ey=66, c_flag=5)
        expected_second = Event(sx=55, sy=96, ex=72, ey=61, c_flag=6)
        result = list(Event.from_links([first, second, third, fourth]))

        count = 0
        for ev in result:
            count += 1
        self.assertEqual(2, count)
        self.assertTrue(expected_first == result[0])
        self.assertTrue(expected_second == result[1])