Esempio n. 1
0
def test_skipauto():
    plug = df.XDressPlugin()
    plugins = DEFAULT_PLUGINS + plug.requires + ('xdress.descfilter', )
    rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins)
    rc._update(plug.defaultrc)
    rc.skipauto = True
    rc.ts = TypeSystem()
    rc.env = {'plane.cpp': {'Plane': plane_class}}

    plug.setup(rc)
    plug.execute(rc)
    plug.teardown(rc)

    exp_plane = {
        'name': 'Plane',
        'namespace': 'util',
        'parents': [],
        'attrs': {
            'homeAirport': 'str',
            'maxrpm': 'float64',
            'manufacturer': 'str',
            'maxspeed': 'float32',
            'position': ('vector', 'float64')
        },
        'methods': {
            ('Plane', ): None,
            ('Plane', ('homeAirport', 'str')): None,
            ('~Plane', ): None,
            ('land', ('coord', (('vector', 'int32', 'const'), '&'))): {
                'return': 'str'
            },
            ('isOnFire', ): {
                'return': 'bool'
            }
        }
    }

    plane = rc.env['plane.cpp']['Plane']
    print('********\nplane class stuff (actual then expected):\n')
    pprint.pprint(plane)
    pprint.pprint(exp_plane)
    assert_equal(plane, exp_plane)
Esempio n. 2
0
def test_skipauto():
    plug = df.XDressPlugin()
    plugins = DEFAULT_PLUGINS + plug.requires + ("xdress.descfilter",)
    rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins)
    rc._update(plug.defaultrc)
    rc.skipauto = True
    rc.ts = TypeSystem()
    rc.env = {"plane.cpp": {"Plane": plane_class}}

    plug.setup(rc)
    plug.execute(rc)
    plug.teardown(rc)

    exp_plane = {
        "name": "Plane",
        "namespace": "util",
        "parents": [],
        "attrs": {
            "homeAirport": "str",
            "maxrpm": "float64",
            "manufacturer": "str",
            "maxspeed": "float32",
            "position": ("vector", "float64"),
        },
        "methods": {
            ("Plane",): None,
            ("Plane", ("homeAirport", "str")): None,
            ("~Plane",): None,
            ("land", ("coord", (("vector", "int32", "const"), "&"))): {"return": "str"},
            ("isOnFire",): {"return": "bool"},
        },
    }

    plane = rc.env["plane.cpp"]["Plane"]
    print("********\nplane class stuff (actual then expected):\n")
    pprint.pprint(plane)
    pprint.pprint(exp_plane)
    assert_equal(plane, exp_plane)
Esempio n. 3
0
def test_skipauto():
    plug = df.XDressPlugin()
    plugins = DEFAULT_PLUGINS + plug.requires + ('xdress.descfilter',)
    rc = RunControl(rc=DEFAULT_RC_FILE, plugins=plugins)
    rc._update(plug.defaultrc)
    rc.skipauto = True
    rc.ts = TypeSystem()
    rc.env = {'plane.cpp': {'Plane': plane_class}}

    plug.setup(rc)
    plug.execute(rc)
    plug.teardown(rc)

    exp_plane = {
        'name': 'Plane',
        'namespace': 'util',
        'parents': [],
        'attrs': {
            'homeAirport': 'str',
            'maxrpm': 'float64',
            'manufacturer': 'str',
            'maxspeed': 'float32',
            'position': ('vector', 'float64')},
        'methods': {
            ('Plane',): None,
            ('Plane', ('homeAirport', 'str')): None,
            ('~Plane',): None,
            ('land', ('coord', (('vector', 'int32', 'const'), '&'))): {
                'return': 'str'},
            ('isOnFire',): {
                'return': 'bool'}}
    }

    plane = rc.env['plane.cpp']['Plane']
    print('********\nplane class stuff (actual then expected):\n')
    pprint.pprint(plane)
    pprint.pprint(exp_plane)
    assert_equal(plane, exp_plane)
Esempio n. 4
0
def test_rc_update():
    rc = RunControl(a=NotSpecified, b="hello")
    rc._update(RunControl(c=1, b="world"))
    assert_equal(rc, {'a': NotSpecified, 'b': 'world', 'c': 1})
    rc._update({'a': 42, 'c': NotSpecified})
    assert_equal(rc, {'a': 42, 'b': 'world', 'c': 1})
Esempio n. 5
0
def test_rc_eq():
    rc = RunControl(a=NotSpecified, b="hello")
    d = {'a': NotSpecified, 'b': 'hello'}
    assert_equal(rc._dict, d)
    assert_equal(rc, RunControl(**d))
Esempio n. 6
0
def test_rc_make():
    rc = RunControl(a=NotSpecified, b="hello")
    assert_equal(rc.a, NotSpecified)
    assert_equal(rc.b, 'hello')
    assert_false(hasattr(rc, 'c'))
Esempio n. 7
0
def test_rc_update():
    rc = RunControl(a=NotSpecified, b="hello")
    rc._update(RunControl(c=1, b="world"))
    assert_equal(rc, {'a': NotSpecified, 'b': 'world', 'c': 1})
    rc._update({'a': 42, 'c': NotSpecified})
    assert_equal(rc, {'a': 42, 'b': 'world', 'c': 1})
Esempio n. 8
0
def test_rc_update():
    rc = RunControl(a=NotSpecified, b="hello")
    rc._update(RunControl(c=1, b="world"))
    assert_equal(rc, {"a": NotSpecified, "b": "world", "c": 1})
    rc._update({"a": 42, "c": NotSpecified})
    assert_equal(rc, {"a": 42, "b": "world", "c": 1})