]> git.draconx.ca Git - cdecl99.git/blobdiff - t/rng.c
tests: Consolidate error messaging a bit.
[cdecl99.git] / t / rng.c
diff --git a/t/rng.c b/t/rng.c
index 3842d3de1ca1c107f11cb3b09ac6e4aec24990ac..2e2fc09ebfe15c48edae62e304a11f0cfbc831b0 100644 (file)
--- a/t/rng.c
+++ b/t/rng.c
@@ -28,7 +28,9 @@
 #include <errno.h>
 #include <limits.h>
 
-#include "test.h"
+#if !TEST_RNG_NO_EXTERNAL_API
+#  include "test.h"
+#endif
 
 #define B64(x) ((x) & 0xffffffffffffffff)
 
@@ -70,6 +72,7 @@ static unsigned long long splitmix64(unsigned long long *state)
        return z ^ (z >> 31);
 }
 
+#if !TEST_RNG_NO_EXTERNAL_API
 struct test_rng *test_rng_alloc(const char *seed_str)
 {
        unsigned long long seed;
@@ -80,7 +83,7 @@ struct test_rng *test_rng_alloc(const char *seed_str)
        limit |= (limit << 16 << 16);
 
        if (!test_strtoumax(&seed_val, seed_str, limit)) {
-               fprintf(stderr, "%s: invalid seed\n", seed_str);
+               print_error("%s: invalid seed", seed_str);
                return NULL;
        }
        seed = seed_val;
@@ -124,3 +127,4 @@ unsigned test_rng_uniform_int(struct test_rng *rng, unsigned max)
 
        return val;
 }
+#endif