Beispiel #1
0
def test_pycparser_describe_device_measure():
    obs = ad.pycparser_describe('device.c', 'Device_measure', 'func', ts=ts)
    exp = {  #'name': {'srcname': 'Device_measure', 'tarname': 'Device_measure'},
        'name': 'Device_measure',
        'namespace': None,
        'signatures': {
            ('Device_measure', ('_0', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), )
            },
            ('Device_measure', ('aiValue', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), )
            },
            ('Device_measure', ('deviceNumber', 'uchar'), ('aiValue', ('uint32', '*'))):
            {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), (Arg.NONE, None))
            },
            ('Device_measure', ('_0', 'uchar'), ('_1', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), (Arg.NONE, None))
            },
        }
    }
    assert_equal_or_diff(obs, exp)
Beispiel #2
0
def test_pycparser_describe_device_descriptor_tag():
    ts.register_class('DeviceDescriptorTag')
    obs = ad.pycparser_describe('device.c',
                                'DeviceDescriptorTag',
                                'class',
                                ts=ts)
    exp = {
        'name': 'DeviceDescriptorTag',
        'type': 'DeviceDescriptorTag',
        'namespace': None,
        'construct': 'struct',
        'parents': None,
        'attrs': {
            'deviceNumber':
            'uchar',
            'deviceMeasurement':
            ('function_pointer', (('_0', ('uint32', '*')), ),
             ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                           1)))),
        },
        'methods': {},
    }
    #pprint(obs)
    #pprint(exp)
    assert_equal(obs, exp)
def test_pycparser_describe_device_measure():
    obs = ad.pycparser_describe('device.c', 'Device_measure', 'func', ts=ts)
    exp = {#'name': {'srcname': 'Device_measure', 'tarname': 'Device_measure'},
           'name': 'Device_measure',
           'namespace': None,
           'signatures': {
            ('Device_measure', ('_0', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                          ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None),)},
            ('Device_measure', ('aiValue', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                          ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None),)},
            ('Device_measure', ('deviceNumber', 'uchar'), 
                               ('aiValue', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                          ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), (Arg.NONE, None))},
            ('Device_measure', ('_0', 'uchar'), 
                               ('_1', ('uint32', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                          ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), (Arg.NONE, None))},
            }
           }
    assert_equal_or_diff(obs, exp)
Beispiel #4
0
def test_pycparser_describe_device_measure():
    obs = ad.pycparser_describe("device.c", "Device_measure", "func", ts=ts)
    exp = {  #'name': {'srcname': 'Device_measure', 'tarname': 'Device_measure'},
        "name": "Device_measure",
        "namespace": None,
        "signatures": {
            ("Device_measure", ("_0", ("uint32", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None),),
            },
            ("Device_measure", ("aiValue", ("uint32", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None),),
            },
            ("Device_measure", ("deviceNumber", "uchar"), ("aiValue", ("uint32", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None), (Arg.NONE, None)),
            },
            ("Device_measure", ("_0", "uchar"), ("_1", ("uint32", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None), (Arg.NONE, None)),
            },
        },
    }
    assert_equal_or_diff(obs, exp)
def test_pycparser_describe_device_measure():
    obs = ad.pycparser_describe('device.c', 'Device_measure', 'func', ts=ts)
    exp = {#'name': {'srcname': 'Device_measure', 'tarname': 'Device_measure'},
           'name': 'Device_measure',
           'namespace': None,
           'signatures': {
            ('Device_measure', ('_0', ('uint32', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            ('Device_measure', ('aiValue', ('uint32', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            ('Device_measure', ('deviceNumber', 'uchar'), 
                               ('aiValue', ('uint32', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            ('Device_measure', ('_0', 'uchar'), 
                               ('_1', ('uint32', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            }
           }
    #pprint(obs)
    #pprint(exp)
    assert_equal(obs, exp)
def test_pycparser_describe_device_init():
    obs = ad.pycparser_describe('device.c', 'Device_Init', 'func', ts=ts)
    exp = {'name': 'Device_Init', 
           'namespace': None,
           'signatures': {
            ('Device_Init', ('_0', ('DeviceParamTag', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            ('Device_Init', ('param', ('DeviceParamTag', '*'))): ('enum', 
                                    'ErrorStatusTag', (('ERROR_OK', 0), 
                                                       ('ERROR_FAILED_INIT', 1))),
            }
           }
    #pprint(exp)
    #pprint(obs)
    assert_equal(exp, obs)
Beispiel #7
0
def test_pycparser_describe_device_init():
    obs = ad.pycparser_describe('device.c', 'Device_Init', 'func', ts=ts)
    exp = {
        'name': 'Device_Init',
        'namespace': None,
        'signatures': {
            ('Device_Init', ('_0', ('DeviceParamTag', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
            ('Device_Init', ('param', ('DeviceParamTag', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
        }
    }
    #pprint(exp)
    #pprint(obs)
    assert_equal(exp, obs)
def test_pycparser_describe_device_init():
    obs = ad.pycparser_describe('device.c', 'Device_Init', 'func', ts=ts)
    exp = {#'name': {'srcname': 'Device_Init', 'tarname': 'Device_Init'},
           'name': 'Device_Init',
           'namespace': None,
           'signatures': {
            ('Device_Init', ('_0', ('DeviceParamTag', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                                                      ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None),)},
            ('Device_Init', ('param', ('DeviceParamTag', '*'))): {
                'return': ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), 
                                                      ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None),)},
            }
           }
    assert_equal_or_diff(obs, exp)
Beispiel #9
0
def test_pycparser_describe_device_init():
    obs = ad.pycparser_describe("device.c", "Device_Init", "func", ts=ts)
    exp = {  #'name': {'srcname': 'Device_Init', 'tarname': 'Device_Init'},
        "name": "Device_Init",
        "namespace": None,
        "signatures": {
            ("Device_Init", ("_0", ("DeviceParamTag", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None),),
            },
            ("Device_Init", ("param", ("DeviceParamTag", "*"))): {
                "return": ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
                "defaults": ((Arg.NONE, None),),
            },
        },
    }
    assert_equal_or_diff(obs, exp)
Beispiel #10
0
def test_pycparser_describe_device_init():
    obs = ad.pycparser_describe('device.c', 'Device_Init', 'func', ts=ts)
    exp = {  #'name': {'srcname': 'Device_Init', 'tarname': 'Device_Init'},
        'name': 'Device_Init',
        'namespace': None,
        'signatures': {
            ('Device_Init', ('_0', ('DeviceParamTag', '*'))): {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), )
            },
            ('Device_Init', ('param', ('DeviceParamTag', '*'))): {
                'return': ('enum', 'ErrorStatusTag',
                           (('ERROR_OK', 0), ('ERROR_FAILED_INIT', 1))),
                'defaults': ((Arg.NONE, None), )
            },
        }
    }
    assert_equal_or_diff(obs, exp)
Beispiel #11
0
def test_pycparser_describe_device_descriptor_tag():
    ts.register_class('DeviceDescriptorTag')
    obs = ad.pycparser_describe('device.c', 'DeviceDescriptorTag', 'class', ts=ts)
    exp = {#'name': {'srcname': 'DeviceDescriptorTag', 'tarname': 'DeviceDescriptorTag'},
           'name': 'DeviceDescriptorTag',
           'type': 'DeviceDescriptorTag',
           'namespace': None,
           'construct': 'struct',
           'parents': [],
           'attrs': {
            'deviceNumber': 'uchar',
            'deviceMeasurement': ('function_pointer', (('_0', ('uint32', '*')),), 
                                    ('enum', 'ErrorStatusTag', (
                                        ('ERROR_OK', 0),
                                        ('ERROR_FAILED_INIT', 1)))),
            },
           'methods': {},
           }
    assert_equal_or_diff(obs, exp)
Beispiel #12
0
def test_pycparser_describe_device_descriptor_tag():
    ts.register_class("DeviceDescriptorTag")
    obs = ad.pycparser_describe("device.c", "DeviceDescriptorTag", "class", ts=ts)
    exp = {  #'name': {'srcname': 'DeviceDescriptorTag', 'tarname': 'DeviceDescriptorTag'},
        "name": "DeviceDescriptorTag",
        "type": "DeviceDescriptorTag",
        "namespace": None,
        "construct": "struct",
        "parents": [],
        "attrs": {
            "deviceNumber": "uchar",
            "deviceMeasurement": (
                "function_pointer",
                (("_0", ("uint32", "*")),),
                ("enum", "ErrorStatusTag", (("ERROR_OK", 0), ("ERROR_FAILED_INIT", 1))),
            ),
        },
        "methods": {},
    }
    assert_equal_or_diff(obs, exp)
Beispiel #13
0
def test_pycparser_describe_device_measure():
    obs = ad.pycparser_describe('device.c', 'Device_measure', 'func', ts=ts)
    exp = {
        'name': 'Device_measure',
        'namespace': None,
        'signatures': {
            ('Device_measure', ('_0', ('uint32', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
            ('Device_measure', ('aiValue', ('uint32', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
            ('Device_measure', ('deviceNumber', 'uchar'), ('aiValue', ('uint32', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
            ('Device_measure', ('_0', 'uchar'), ('_1', ('uint32', '*'))):
            ('enum', 'ErrorStatusTag', (('ERROR_OK', 0), ('ERROR_FAILED_INIT',
                                                          1))),
        }
    }
    #pprint(obs)
    #pprint(exp)
    assert_equal(obs, exp)