/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the basic features of Virtual File Drivers * * Return: Success: 0 * Failure: 1 * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * *------------------------------------------------------------------------- */ int main(void) { int nerrors = 0; h5_reset(); printf("Testing basic Virtual File Driver functionality.\n"); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_multi_compat() < 0 ? 1 : 0; nerrors += test_direct() < 0 ? 1 : 0; nerrors += test_log() < 0 ? 1 : 0; nerrors += test_stdio() < 0 ? 1 : 0; nerrors += test_windows() < 0 ? 1 : 0; if(nerrors) { printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } printf("All Virtual File Driver tests passed.\n"); return 0; }
int main(void) { init_prime_table(); for (unsigned n = 11; n < prime_max; n += 2) { if (is_prime(n)) { if (test_family(n)) { printf("%u\n", n); break; } } } return 0; }
/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the basic features of Virtual File Drivers * * Return: Success: exit(0) * Failure: exit(1) * * Programmer: Raymond Lu * Tuesday, Sept 24, 2002 * *------------------------------------------------------------------------- */ int main(void) { int nerrors = 0; h5_reset(); nerrors += test_sec2() < 0 ? 1 : 0; nerrors += test_core() < 0 ? 1 : 0; nerrors += test_family() < 0 ? 1 : 0; nerrors += test_family_compat() < 0 ? 1 : 0; nerrors += test_multi() < 0 ? 1 : 0; nerrors += test_direct() < 0 ? 1 : 0; if(nerrors) { printf("***** %d Virtual File Driver TEST%s FAILED! *****\n", nerrors, nerrors > 1 ? "S" : ""); return 1; } printf("All Virtual File Driver tests passed.\n"); return 0; }
/*------------------------------------------------------------------------- * Function: main * * Purpose: * * Return: Success: * * Failure: * * Programmer: Robb Matzke * Friday, April 10, 1998 * * Modifications: * Albert Cheng, 2002/03/28 * Added command option -fsize. * Albert Cheng, 2002/04/19 * Added command option -c. * * Raymond Lu, 2007/05/25 * Added similar tests for SEC2 and STDIO drivers. * *------------------------------------------------------------------------- */ int main (int ac, char **av) { unsigned long seed = 0; /* Random # seed */ hid_t fapl = -1; hid_t driver = -1; /* parameters setup */ while (--ac > 0){ av++; if (HDstrcmp("-fsize", *av)==0){ /* specify a different family file size */ ac--; av++; if (ac > 0) { family_size_def = (hsize_t)HDstrtoull(*av, NULL, 0); } else{ printf("***Missing fsize value***\n"); usage(); return 1; } } else if (HDstrcmp("-c", *av)==0){ /* turn off file system check before test */ cflag=0; } else if (HDstrcmp("-h", *av)==0){ usage(); return 0; }else{ usage(); return 1; } } /* check VFD to see if this is one we test */ if((fapl = h5_fileaccess()) < 0) goto error; if((driver = H5Pget_driver(fapl)) < 0) goto error; /* check sparse file support unless cflag is not set. */ if(cflag) sparse_support = is_sparse(); /* Choose random # seed */ seed = (unsigned long)HDtime(NULL); #ifdef QAK /* seed = (unsigned long)1155438845; */ HDfprintf(stderr, "Random # seed was: %lu\n", seed); #endif /* QAK */ HDsrandom(seed); /* run VFD-specific test */ if(H5FD_SEC2 == driver) { if(test_sec2(fapl) != 0) goto error; } else if(H5FD_STDIO == driver) { if(test_stdio(fapl) != 0) goto error; } else if(H5FD_FAMILY == driver) { if(test_family(fapl) != 0) goto error; } else HDputs("This VFD is not supported"); /* End with normal exit code */ /* fapls are cleaned up in the vfd test code */ return 0; error: HDputs("*** TEST FAILED ***"); if(fapl > 0) H5Pclose(fapl); return 1; }