Пример #1
0
 def test_LR(self):
     file = "test_LR1.jpg"
     interpret(
         "type LR 'lexer analysis' -- 'parser analysis' -- layout -- draw",
         "test_LR1.jpg")
     correct_file = "test_LR1_correct.jpg"
     self.assertEqual(filecmp.cmp(file, correct_file), True)
Пример #2
0
    def test_syntax_with_transition(self):
        input = "type LR 1|.1 -10- 2|.2 \n 3|.3 -20- 4|.4 " \
                "\n type transition 1-hh-3"

        file = "test_syntax_with_transition.jpg"
        correct_file = "test_syntax_with_transition_correct.jpg"
        interpret(input, file)
Пример #3
0
    def test_draw_lr_circle(self):
        input = "type LR .1 -10- .2 "

        file = "test_draw_lr_circle.jpg"
        correct_file = "test_draw_lr_circle_correct.jpg"
        interpret(input, file)

        self.assertEqual(filecmp.cmp(file, correct_file), True)
Пример #4
0
    def DefineTransition(self):
        input = "type LR  1'ancestor1 male'" \
                     " \n 2'ancestor2 male' " \
                   "\n 3'qmei female' 4'xhe male' \n 5'lming male'" \
                     "transition 1>2 2>3 3>5 "

        file = "test_DefineTransition.jpg"
        interpret(input, file)
Пример #5
0
    def test_draw_multi_level_lr_circle(self):
        input = "type LR .1 -10- .2 \n .3 -20- .4"

        file = "test_draw_multi_level_lr_circle.jpg"
        correct_file = "test_draw_multi_level_lr_circle.jpg"
        interpret(input, file)
Пример #6
0
 def test_newTD(self):
     file = "td.jpg"
     correct_file = "td_correct.jpg"
     interpret("type TD this -- is -- top -- to -- down -- graph", file)
Пример #7
0
    def test_newLR(self):
        file = "lr.jpg"
        interpret("type LR this -- is -- left -- to -- right -- graph", file)

        correct_file = "lr_correct.jpg"
        self.assertEqual(filecmp.cmp(file, correct_file), True)
Пример #8
0
 def test_Mul_LR(self):
     file = "test_LR1.jpg"
     interpret(
         "type LR 'lexer analysis' -- 'parser analysis' -- layout -- draw \n a -- b -- c",
         "test_Mul_LR.jpg")