def check_choice_combinations(cfstr, fnameargslist): cfdec = cfdec_parse(cfstr) clist = [tuple(c) for c in choice_combinations(cfdec)] ret = set(clist) ok_(len(ret) == len(clist), 'choice_combinations returns redundant element(s)') correct = set(fa[1] for fa in fnameargslist) eq_(ret, correct, ('choice_combinations(cfdec_parse(%s)) ' 'returns incorrect value' % cfstr))
def check_choice_combinations(cfstr, fnameargslist): cfdec = cfdec_parse(cfstr) clist = [tuple(c) for c in choice_combinations(cfdec)] ret = set(clist) ok_( len(ret) == len(clist), 'choice_combinations returns redundant element(s)') correct = set(fa[1] for fa in fnameargslist) eq_(ret, correct, ('choice_combinations(cfdec_parse(%s)) ' 'returns incorrect value' % cfstr))
def load_cfunc(cdll, cfuncs_parsed, struct_type_p, cfuncprefix, idxset): cfunc_loaded = {} def get_arg_ct(ag): if ag['aname'] in idxset: return c_int elif ag['cdt'] in idxset: return c_int else: return CDT2CTYPE[ag['cdt']] for (fname, parsed) in cfuncs_parsed.iteritems(): for args in choice_combinations(parsed): cfname = parsed.fnget(*args) cf = cdll[cfuncprefix + cfname] cf.restype = c_int cf.argtypes = ( [struct_type_p] + map(get_arg_ct, parsed.args)) cfunc_loaded[cfname] = cf return cfunc_loaded