/* * 'tests.c' created: Tue Oct 15 23:08:47 2002 * * Copyright 2002 by Lubomir Host <8host AT pauli.fmph.uniba.sk> * * License: GNU GPL (GNU Public License) * */ /* $Platon: diplomovka/rng/src/tests.c,v 1.1 2002/10/24 12:05:38 rajo Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "main.h" #include "tests.h" #include "devices.h" #include "test-square.h" #include "test-speed.h" #include "test-kolmogorov-smirnov.h" #include "test-korelation.h" RNG_test_t *rng_tests[] = { &RNG_test_korel, &RNG_test_kolmog, &RNG_test_square, &RNG_test_speed, NULL }; int make_test(int *counts) { int i = 0; int retval = RNG_OK; /* Initialize all generators * /dev/urandom --> open("/dev/urandom"); * rand() --> srand(unsigned int seed); */ while (rng_tests[i] != NULL && retval == RNG_OK) { if ((retval = open_devices()) != RNG_OK) { fprintf(stderr, "# @@ Opening all devices failed!\n"); return retval; } printf("## Running %s: \n", (*rng_tests[i]).desc); retval = (*rng_tests[i++]).run(counts); printf("# %s\n", RETVAL_STRING(retval)); if ((retval = close_devices()) != RNG_OK) { fprintf(stderr, "# @@ Closing all devices failed!\n"); return retval; } } return retval; } /* Modeline for ViM {{{ * vim: set ts=4: * vim600: fdm=marker fdl=0 fdc=3: * }}} */