/* * Copyright (c) 2011 Luka Marčetić * * Redistribution and use in source and binary forms, with or without * modification, are permitted. * * There's ABSOLUTELY NO WARRANTY, express or implied. */ //A union for return values of functions union ret { char c; char* s; int i; void* vp; }; ///Atrucutre designed to hold test data struct test { char *fn_name; //function name for the output unsigned int narg; //number of arguments that the function takes unsigned int ndata; //number of test datasets struct data { struct arguments {unsigned int nr; void *vp;} *arg; void *ret; int err; } *data; }; ///Handy macro to get a certain value from an element via the arg void pointer ///Note: it requires arg and i to be a pointer to struct arguments & an iterator // hint: see iter and arg arguments for index() #define ARGV(TYPE, INDEX) ((TYPE *) arg[INDEX].vp)[index(i, arg, INDEX)] /** ** \returns the cardinality of a cartesian product of sets of arguments ** ie the number of iterations required to cover all argument values ** \param t a test to which the arguments belong ** \param d an index of the dataset from t to be taken into consideration **/ size_t iters(struct test t, unsigned int d) { size_t i, product=1; for (i=0; i