1 #include <ccan/eratosthenes/eratosthenes.h>
2 #include <ccan/tap/tap.h>
4 #include <ccan/eratosthenes/eratosthenes.c>
9 ok((a) == (b), "%s [%u] == %s [%u]", \
10 #a, (unsigned)(a), #b, (unsigned)(b))
14 struct eratosthenes s1, s2;
17 /* This is how many tests you plan to run */
20 eratosthenes_init(&s1);
21 eratosthenes_sieve(&s1, LIMIT);
23 eratosthenes_init(&s2);
24 for (n = 1; n <= LIMIT; n++)
25 eratosthenes_sieve(&s2, n);
27 for (n = 0; n < LIMIT; n++)
28 ok1(eratosthenes_isprime(&s1, n)
29 == eratosthenes_isprime(&s2, n));
31 eratosthenes_reset(&s1);
32 eratosthenes_reset(&s2);
34 /* This exits depending on whether all tests passed */