+static int t_primep(dstr *v)
+{
+ mp *m = *(mp **)v[0].buf;
+ int e = *(int *)v[1].buf;
+ int r;
+ grand *rng;
+ int ok = 1;
+
+ rng = fibrand_create(0);
+ r = pgen_primep(m, rng);
+ GR_DESTROY(rng);
+ if (e != r) {
+ fputs("\n*** primep failed", stderr);
+ fputs("\nm = ", stderr); mp_writefile(m, stderr, 10);
+ fprintf(stderr, "\nexpected %d", e);
+ fprintf(stderr, "\nreported %d", r);
+ fputc('\n', stderr);
+ ok = 0;
+ }
+
+ mp_drop(m);
+ assert(mparena_count(MPARENA_GLOBAL) == 0);
+ return (ok);
+}
+