Пример #1
0
 def test_multi_functions(self):
     mod = ext_tools.ext_module('module_multi_function')
     var_specs = []
     code = ""
     test = ext_tools.ext_function_from_specs('test',code,var_specs)
     mod.add_function(test)
     test2 = ext_tools.ext_function_from_specs('test2',code,var_specs)
     mod.add_function(test2)
     mod.compile(location=build_dir)
     import module_multi_function
     module_multi_function.test()
     module_multi_function.test2()
Пример #2
0
 def test_multi_functions(self):
     mod = ext_tools.ext_module('module_multi_function')
     var_specs = []
     code = ""
     test = ext_tools.ext_function_from_specs('test',code,var_specs)
     mod.add_function(test)
     test2 = ext_tools.ext_function_from_specs('test2',code,var_specs)
     mod.add_function(test2)
     mod.compile(location=build_dir)
     import module_multi_function
     module_multi_function.test()
     module_multi_function.test2()
Пример #3
0
 def test_simple(self):
     # Simplest possible function
     mod = ext_tools.ext_module('simple_ext_function')
     var_specs = []
     code = ""
     test = ext_tools.ext_function_from_specs('test',code,var_specs)
     mod.add_function(test)
     mod.compile(location=build_dir)
     import simple_ext_function
     simple_ext_function.test()
Пример #4
0
 def test_simple(self):
     # Simplest possible function
     mod = ext_tools.ext_module('simple_ext_function')
     var_specs = []
     code = ""
     test = ext_tools.ext_function_from_specs('test',code,var_specs)
     mod.add_function(test)
     mod.compile(location=build_dir)
     import simple_ext_function
     simple_ext_function.test()
Пример #5
0
 def no_check_var_local(self,level=5):
     mod = ext_tools.ext_module('wx_var_local')
     a = 'string'
     code = 'a="hello";'
     var_specs = ext_tools.assign_variable_types(['a'],locals())
     test = ext_tools.ext_function_from_specs('test',code,var_specs)
     mod.add_function(test)
     mod.compile()
     import wx_var_local
     b='bub'
     q={}
     wx_var_local.test(b,q)
     assert('a' == 'string')
Пример #6
0
    def check_with_include(self,level=5):
        # decalaring variables
        a = 2.;

        # declare module
        mod = ext_tools.ext_module('ext_module_with_include')
        mod.customize.add_header('<iostream>')

        # function 2 --> a little more complex expression
        var_specs = ext_tools.assign_variable_types(['a'],locals(),globals())
        code = """
               std::cout << std::endl;
               std::cout << "test printing a value:" << a << std::endl;
               """
        test = ext_tools.ext_function_from_specs('test',code,var_specs)
        mod.add_function(test)
        # build module
        mod.compile(location = build_dir)
        import ext_module_with_include
        ext_module_with_include.test(a)
Пример #7
0
    def test_with_include(self):
        # decalaring variables
        a = 2.

        # declare module
        mod = ext_tools.ext_module('ext_module_with_include')
        mod.customize.add_header('<iostream>')

        # function 2 --> a little more complex expression
        var_specs = ext_tools.assign_variable_types(['a'],locals(),globals())
        code = """
               std::cout.clear(std::ios_base::badbit);
               std::cout << std::endl;
               std::cout << "test printing a value:" << a << std::endl;
               std::cout.clear(std::ios_base::goodbit);
               """
        test = ext_tools.ext_function_from_specs('test',code,var_specs)
        mod.add_function(test)
        # build module
        mod.compile(location=build_dir)
        import ext_module_with_include
        ext_module_with_include.test(a)