예제 #1
0
파일: test_ext_tools.py 프로젝트: b-t-g/Sim
 def test_string_and_int(self):
     # decalaring variables
     a = 2;b = 'string'
     # declare module
     mod = ext_tools.ext_module('ext_string_and_int')
     code = """
            a=b.length();
            return_val = PyInt_FromLong(a);
            """
     test = ext_tools.ext_function('test',code,['a','b'])
     mod.add_function(test)
     mod.compile(location = build_dir)
     import ext_string_and_int
     c = ext_string_and_int.test(a,b)
     assert_(c == len(b))
예제 #2
0
 def test_string_and_int(self):
     # decalaring variables
     a = 2;b = 'string'
     # declare module
     mod = ext_tools.ext_module('ext_string_and_int')
     code = """
            a=b.length();
            return_val = PyInt_FromLong(a);
            """
     test = ext_tools.ext_function('test',code,['a','b'])
     mod.add_function(test)
     mod.compile(location = build_dir)
     import ext_string_and_int
     c = ext_string_and_int.test(a,b)
     assert(c == len(b))
예제 #3
0
    def test_string_and_int(self):
        # decalaring variables
        a = 2
        b = "string"
        # declare module
        mod = ext_tools.ext_module("ext_string_and_int")
        code = """
               a=b.length();
               return_val = PyInt_FromLong(a);
               """
        test = ext_tools.ext_function("test", code, ["a", "b"])
        mod.add_function(test)
        mod.compile(location=build_dir)
        import ext_string_and_int

        c = ext_string_and_int.test(a, b)
        assert_(c == len(b))