in commons-rng-examples/examples-stress/src/main/c/stdin2testu01.c [265:300]
int main(int argc,
char **argv) {
if (argc < 2) {
printf("[ERROR] Specify test suite: '%s', '%s' or '%s'\n", TU_S, TU_C, TU_B);
exit(1);
}
unif01_Gen *gen = createStdinReader();
char *spec = argv[1];
if (strcmp(spec, TU_S) == 0) {
bbattery_SmallCrush(gen);
} else if (strcmp(spec, TU_C) == 0) {
bbattery_Crush(gen);
} else if (strcmp(spec, TU_B) == 0) {
bbattery_BigCrush(gen);
} else if (strcmp(spec, T_RAW_32) == 0) {
unsigned long count = getCount(argc, argv);
/* Print to stdout until stdin closes or count is reached. */
while (count--) {
printInt(nextInt(0, gen->state));
}
} else if (strcmp(spec, T_RAW_64) == 0) {
unsigned long count = getCount(argc, argv);
/* Print to stdout until stdin closes or count is reached. Use dedicated 64-bit reader. */
while (count--) {
printLong(nextLong(gen->state));
}
} else {
printf("[ERROR] Unknown specification: '%s'\n", spec);
exit(1);
}
deleteStdinReader(gen);
return 0;
}