예제 #1
0
def test_composite_state_body_2():
    print('composite_state_body 2:')

    test = parser_init(string='''state ENTRYA;
              endstate;
    ''')

    test.composite_state_body()
예제 #2
0
def test_composite_state_body_2():
    print('composite_state_body 2:')

    test=parser_init(string=
    '''state ENTRYA;
              endstate;
    ''')

    test.composite_state_body()
예제 #3
0
def test_2():
    ''' Test the parsing of numbers '''
    test = parser_init(string='''provided true priority 5;''')
    with samnmax.capture_output() as (stdout, stderr):
        test.continuous_signal()
    errCount = 0
    for each in stderr:
        print('[ERROR] ' + str(each))
        errCount += 1
    assert not errCount
예제 #4
0
def test_2():
    ''' Test the parsing of numbers '''
    test = parser_init(string='''provided true priority 5;''')
    with samnmax.capture_output() as (stdout, stderr):
        test.continuous_signal()
    errCount = 0
    for each in stderr:
        print('[ERROR] ' + str(each))
        errCount += 1
    assert not errCount
예제 #5
0
def test_composite_state_2():
    print('composite_state (should have no error)')

    test = parser_init(string='''state CHECKING;
            substructure
              state ENTRYA;
              endstate ENTRYA;
            endsubstructure CHECKING;
    ''')

    test.composite_state()
예제 #6
0
def test_composite_state_2():
    print('composite_state (should have no error)')

    test=parser_init(string=
    '''state CHECKING;
            substructure
              state ENTRYA;
              endstate ENTRYA;
            endsubstructure CHECKING;
    ''')

    test.composite_state()
예제 #7
0
def test_composite_state_1():
    ''' Detect the syntax error (missing SEMI after "procedure entry") '''
    test = parser_init(string='''state CHECKING;
            substructure
              state ENTRYA;
              substructure
                procedure entry EXTERNAL;
              endsubstructure ENTRYA;
            endsubstructure CHECKING;
    ''')

    test.composite_state()
예제 #8
0
def test_composite_state_1():
    ''' Detect the syntax error (missing SEMI after "procedure entry") '''
    test = parser_init(string=
    '''state CHECKING;
            substructure
              state ENTRYA;
              substructure
                procedure entry EXTERNAL;
              endsubstructure ENTRYA;
            endsubstructure CHECKING;
    ''')

    test.composite_state()
예제 #9
0
def test_composite_state_3():
    print('from rm - reports that start must be before state:')
    test = parser_init(string='''
    STATE AGGREGATION DemoDeviceDACPStates;
            SUBSTRUCTURE
              STATE INTERNAL_MAPPINGS;
                SUBSTRUCTURE
                  STATE STATELESS;
                  ENDSTATE STATELESS;
                  START;
                  NEXTSTATE STATELESS;
                ENDSUBSTRUCTURE INTERNAL_MAPPINGS;
            ENDSUBSTRUCTURE DemoDeviceDACPStates;
    ''')

    test.composite_state()
예제 #10
0
def test_composite_state_3():
    print('from rm - reports that start must be before state:')
    test=parser_init(string=
    '''
    STATE AGGREGATION DemoDeviceDACPStates;
            SUBSTRUCTURE
              STATE INTERNAL_MAPPINGS;
                SUBSTRUCTURE
                  STATE STATELESS;
                  ENDSTATE STATELESS;
                  START;
                  NEXTSTATE STATELESS;
                ENDSUBSTRUCTURE INTERNAL_MAPPINGS;
            ENDSUBSTRUCTURE DemoDeviceDACPStates;
    ''')

    test.composite_state()
예제 #11
0
def test_composite_state_body_1():
    ''' Detect the syntax error (missing SEMI after "procedure entry") '''
    test = parser_init(string='''state ENTRYA;
       substructure
           procedure entry external;
       endsubstructure ENTRYA;''')
    # Parse and then check that the reported error is the expected one

    res = test.composite_state_body()
    assert (not isinstance(res.tree, antlr3.tree.CommonErrorNode))
    composite = res.tree.children[0]
    compo_type = token(composite.type)
    assert (compo_type == 'COMPOSITE_STATE')
    for each in composite.children:
        if isinstance(each, antlr3.tree.CommonErrorNode):
            exception = each.trappedException
            assert (isinstance(exception, antlr3.NoViableAltException))
            assert (token(exception.unexpectedType) == 'EXTERNAL')
예제 #12
0
def test_composite_state_4():
    print('from rm(2) - reports that start must be before state:')
    test = parser_init(string='''
    process hello;
    STATE AGGREGATION DemoDeviceDACPStates;
            SUBSTRUCTURE
              STATE INTERNAL_MAPPINGS;
                SUBSTRUCTURE
                  STATE STATELESS;
                  ENDSTATE STATELESS;
                  START;
                  NEXTSTATE STATELESS;
                ENDSUBSTRUCTURE INTERNAL_MAPPINGS;
            ENDSUBSTRUCTURE DemoDeviceDACPStates;
    end hello;
    ''')

    test.process_definition()
예제 #13
0
def test_composite_state_4():
    print('from rm(2) - reports that start must be before state:')
    test=parser_init(string=
    '''
    process hello;
    STATE AGGREGATION DemoDeviceDACPStates;
            SUBSTRUCTURE
              STATE INTERNAL_MAPPINGS;
                SUBSTRUCTURE
                  STATE STATELESS;
                  ENDSTATE STATELESS;
                  START;
                  NEXTSTATE STATELESS;
                ENDSUBSTRUCTURE INTERNAL_MAPPINGS;
            ENDSUBSTRUCTURE DemoDeviceDACPStates;
    end hello;
    ''')

    test.process_definition()
예제 #14
0
def test_composite_state_body_1():
    ''' Detect the syntax error (missing SEMI after "procedure entry") '''
    test = parser_init(string=
    '''state ENTRYA;
       substructure
           procedure entry external;
       endsubstructure ENTRYA;''')
    # Parse and then check that the reported error is the expected one

    res = test.composite_state_body()
    assert(not isinstance(res.tree, antlr3.tree.CommonErrorNode))
    composite = res.tree.children[0]
    compo_type = sdl92Parser.tokenNames[composite.type]
    assert(compo_type == 'COMPOSITE_STATE')
    for each in composite.children:
        if isinstance(each, antlr3.tree.CommonErrorNode):
            exception = each.trappedException
            assert(isinstance(exception,antlr3.NoViableAltException))
            assert(token(exception.unexpectedType) == 'EXTERNAL')
예제 #15
0
def test_1():
    ''' Test the parsing of numbers '''
    test = parser_init(string='''provided true=false; priority 5;''')
    res = test.continuous_signal()
    assert (not isinstance(res.tree, antlr3.tree.CommonErrorNode))
예제 #16
0
def test_1():
    ''' Test the parsing of numbers '''
    test = parser_init(string='''provided true=false; priority 5;''')
    res = test.continuous_signal()
    assert(not isinstance(res.tree, antlr3.tree.CommonErrorNode))
예제 #17
0
def test_minus():
    ''' Test the parsing of numbers '''
    test = parser_init(string='''1-1''')
    test.expression()