Changeset: f5a96e482c55 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f5a96e482c55 Modified Files: monetdb5/mal/mal_interpreter.c Branch: default Log Message:
Add assertions that the actual result of a call matches the expected result. diffs (57 lines): diff --git a/monetdb5/mal/mal_interpreter.c b/monetdb5/mal/mal_interpreter.c --- a/monetdb5/mal/mal_interpreter.c +++ b/monetdb5/mal/mal_interpreter.c @@ -627,11 +627,52 @@ str runMALsequence(Client cntxt, MalBlkP if (pci->fcn == NULL) { ret = createScriptException(mb, stkpc, MAL, NULL, "address of pattern %s.%s missing", pci->modname, pci->fcnname); - } else + } else { ret = (str)(*pci->fcn)(cntxt, mb, stk, pci); +#ifndef NDEBUG + /* check that the types of actual results match + * expected results */ + for (i = 0; i < pci->retc; i++) { + int a = getArg(pci, i); + int t = getArgType(mb, pci, i); + + if (isaBatType(t)) { + bat bid = stk->stk[a].val.bval; + t = getColumnType(t); + assert(stk->stk[a].vtype == TYPE_bat); + assert(bid == 0 || + bid == bat_nil || + t == TYPE_any || + ATOMtype(BBP_cache(bid)->ttype) == ATOMtype(t)); + } else { + assert(t == stk->stk[a].vtype); + } + } +#endif + } break; case CMDcall: ret =malCommandCall(stk, pci); +#ifndef NDEBUG + /* check that the types of actual results match + * expected results */ + for (i = 0; i < pci->retc; i++) { + int a = getArg(pci, i); + int t = getArgType(mb, pci, i); + + if (isaBatType(t)) { + bat bid = stk->stk[a].val.bval; + t = getColumnType(t); + assert(stk->stk[a].vtype == TYPE_bat); + assert(bid == 0 || + bid == bat_nil || + t == TYPE_any || + ATOMtype(BBP_cache(bid)->ttype) == ATOMtype(t)); + } else { + assert(t == stk->stk[a].vtype); + } + } +#endif break; case FACcall: /* _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list