def test_c_proto_return_type(self): for dtype in (pyf.default_real, pyf.default_integer): return_arg = pyf.Argument(name='ret_arg', dtype=dtype, is_return_arg=True) empty_func = pyf.Function(name='foo', args=[], return_arg=return_arg) am = fc_wrap.ArgWrapperManager(empty_func) #XXX eq_(am.c_proto_return_type(), 'void') empty_subr = pyf.Subroutine(name='foo', args=[]) am_subr = fc_wrap.ArgWrapperManager(empty_subr) #XXX eq_(am_subr.c_proto_return_type(), 'void')
def setup(self): dlgcl = pyf.default_logical dint = pyf.IntegerType(fw_ktp='int') self.lgcl = pyf.Argument(name='ll', dtype=dlgcl, intent='out', is_return_arg=True) self.int = pyf.Argument(name='int', dtype=dint, intent='out', is_return_arg=True) subr = pyf.Subroutine('foo', args=[self.lgcl]) self.am_lgcl = fc_wrap.ArgWrapperManager(subr) subr = pyf.Subroutine('foo', args=[self.int]) self.am_int = fc_wrap.ArgWrapperManager(subr)
def setup(self): dlgcl = pyf.default_logical dint = pyf.IntegerType(fw_ktp='int') self.lgcl1 = pyf.Argument(name='lgcl1', dtype=dlgcl, intent='inout') self.lgcl2 = pyf.Argument(name='lgcl2', dtype=dlgcl, intent='inout') self.intarg = pyf.Argument(name='int', dtype=dint, intent='inout') self.args = [self.lgcl1, self.lgcl2, self.intarg] self.l1wrap = fc_wrap.LogicalWrapper(self.lgcl1) self.l2wrap = fc_wrap.LogicalWrapper(self.lgcl2) subr = pyf.Subroutine('foo', args=self.args) self.am = fc_wrap.ArgWrapperManager(subr)
def test_c_proto_array_args(self): args = [ pyf.Argument(name='array', dtype=pyf.default_real, dimension=(':', ) * 3, intent='out') ] subr = pyf.Subroutine('foo', args=args) arg_man = fc_wrap.ArgWrapperManager(subr) eq_(arg_man.c_proto_args(), [ 'fwi_npy_intp_t *', 'fwi_npy_intp_t *', 'fwi_npy_intp_t *', 'fwr_real_t *', 'fwi_integer_t *', 'fw_character_t *' ])
def test_c_proto_args(self): args = [ pyf.Argument(name='int_arg', dtype=pyf.default_integer, intent='in'), pyf.Argument(name='real_arg', dtype=pyf.default_real, intent='out') ] return_arg = pyf.Argument(name='fname', dtype=pyf.default_real) func = pyf.Function('foo', args=args, return_arg=return_arg) arg_man = fc_wrap.ArgWrapperManager(func) eq_(arg_man.c_proto_args(), [ 'fwr_real_t *', 'fwi_integer_t *', 'fwr_real_t *', 'fwi_integer_t *', 'fw_character_t *' ])