bool solvetestVariableSize(unsigned n) { Size s(n, n); for (unsigned i = 0; i < 100; ++i) if (!solvetest(rMatrix(s), rnVec(s(0)))) return false; return true; }
bool solvetestFixedSize(void) { Size s(n, n); for (unsigned i = 0; i < 100; ++i) if (!solvetest(rMatrix(s), rVec(s(0)))) return false; return true; }
int testmacro(char *bufa, char *bufb, int *inda, int *indb) { int state = 0; if (*indb >= 10 * MAXMACLEN) return 0; /* maybe we should do something more "safe" here (and at other returns)? */ while (bufa[*inda] && (*indb < 10 * MAXMACLEN)) { if (state) { switch (bufa[(*inda)++]) { case '*': /* push %* into buf */ if (*indb < 10 * MAXMACLEN - 2) { bufb[*indb] = '%'; (*indb)++; bufb[*indb] = '*'; (*indb)++; } else return (0); /* we are full, so we are done */ state = 0; continue; case '%': /* push %% into buf */ if (*indb < 10 * MAXMACLEN - 2) { bufb[*indb] = '%'; (*indb)++; bufb[*indb] = '%'; (*indb)++; } else return (0); /* we are full, so we are done */ state = 0; continue; case '{': /* push %{ into buf */ if (*indb < 10 * MAXMACLEN - 2) { bufb[*indb] = '%'; (*indb)++; bufb[*indb] = '{'; (*indb)++; } else return (0); /* we are full, so we are done */ state = 0; continue; case '}': /* push %} into buf */ if (*indb < 10 * MAXMACLEN - 2) { bufb[*indb] = '%'; (*indb)++; bufb[*indb] = '}'; (*indb)++; } else return (0); /* we are full, so we are done */ state = 0; continue; case '!': /* push %! into buf */ if (*indb < 10 * MAXMACLEN - 2) { bufb[*indb] = '%'; (*indb)++; bufb[*indb] = '!'; (*indb)++; } else return (0); /* we are full, so we are done */ state = 0; continue; case '?': /* the dreaded conditional, evaluate it */ bufb[*indb] = '0' + solvetest(bufa, inda); (*indb)++; state = 0; continue; default: warning("Bad character in Macro!"); printf("Unrecognizable special character in macro pass2: %c Trying to continue.\n", bufa[(*inda) - 1]); state = 0; continue; } } if (bufa[*inda] == '%') { state++; (*inda)++; continue; } state = 0; if (*indb < 10 * MAXMACLEN) { bufb[*indb] = bufa[*inda]; (*inda)++; (*indb)++; } else return (0); } return (0); }