int main() { //超时事件测试 //timer_test(); //IO事件测试 io_test(); //信号测试 //signal_test(); return 0; }
int main(int argc, char **argv){ printf("test read filenames in dir\n"); unsigned int nbfiles = 0; char **files = readfilenames(TESTDIR, &nbfiles); assert(nbfiles == 3); printf("test audio hash\n"); test_audiohash(); printf("simple test\n"); simple_test(); printf("io test\n"); io_test(); printf("done\n"); return 0; }
int main(int argc, char ** argv) { table_t *tab; int ret, iter_n = ITERATIONS, alignment = 0; long seed; argc--, argv++; /* set default seed */ seed = time(NULL); /* process the args */ for (; *argv != NULL; argv++, argc--) { if (**argv != '-') { continue; } switch (*(*argv + 1)) { case 'a': auto_adjust_b = 1; break; case 'A': if (argc > 0) { argv++, argc--; if (argc == 0) { usage(); } alignment = atoi(*argv); } break; case 'i': if (argc > 0) { argv++, argc--; if (argc == 0) { usage(); } iter_n = atoi(*argv); } break; case 'l': large_b = 1; break; case 's': if (argc > 0) { argv++, argc--; if (argc == 0) { usage(); } seed = atol(*argv); } break; case 'v': verbose_b = 1; break; default: usage(); break; } } if (argc > 0) { usage(); } (void)srandom(seed); (void)printf("Seed for random is %ld\n", seed); /* alloc the test table */ call_c++; tab = table_alloc(0, &ret); if (tab == NULL) { (void)printf("table_alloc returned: %s\n", table_strerror(ret)); exit(1); } if (auto_adjust_b) { ret = table_attr(tab, TABLE_FLAG_AUTO_ADJUST); if (ret != TABLE_ERROR_NONE) { (void)fprintf(stderr, "ERROR: could not set table for auto-adjust: %s\n", table_strerror(ret)); exit(1); } } if (alignment > 0) { ret = table_set_data_alignment(tab, alignment); if (ret != TABLE_ERROR_NONE) { (void)fprintf(stderr, "ERROR: could not set data alignment to %d: %s\n", alignment, table_strerror(ret)); exit(1); } } basic(tab); stress(tab, iter_n, 0); io_test(tab); order_test(tab); call_c++; ret = table_free(tab); if (ret != TABLE_ERROR_NONE) { (void)fprintf(stderr, "ERROR in table_free: %s\n", table_strerror(ret)); } (void)fputc('\n', stdout); (void)printf("Test program performed %d table calls\n", call_c); exit(0); }
/* main *********************************************************************/ int main (int argc, char const * const * argv) { void * p; void * q; void * r; uint_t ui; int i; (void) argc; (void) argv; printf("hbs1 test\n"); printf("- c41 lib: %s.%u\n", c41_lib_name(), c41_lib_minor()); printf("- hbs1 lib: %s.%u\n", hbs1_lib_name(), hbs1_lib_minor()); ui = hbs1_ma_init(&ma); printf("- ma.init: %s\n", hbs1_status_name(ui)); if (ui) return 1; ui = c41_ma_alloc(&ma, &p, 0); printf("- ma.alloc(0): %s %p\n", c41_ma_status_name(ui), p); if (ui || p) goto l_ma_finish; ui = c41_ma_realloc(&ma, &p, 10, 0); printf("- ma.realloc(NULL, 10, 0): %s %p\n", c41_ma_status_name(ui), p); if (ui || !p) goto l_ma_finish; ui = c41_ma_alloc(&ma, &r, 30); printf("- ma.alloc(30): %s %p\n", c41_ma_status_name(ui), r); q = p; ui = c41_ma_realloc(&ma, &p, 200, 10); printf("- ma.realloc(p, 200, 10): %s %p->%p\n", c41_ma_status_name(ui), q, p); q = r; ui = c41_ma_realloc(&ma, &r, 0, 30); printf("- ma.realloc(p, 0, 30): %s %p->%p\n", c41_ma_status_name(ui), q, r); ui = c41_ma_free(&ma, p, 200); printf("- ma.free(p, 200): %s (p=%p)\n", c41_ma_status_name(ui), p); ui = c41_ma_free(&ma, p, 0); printf("- ma.free(p, 0): %s (p=%p)\n", c41_ma_status_name(ui), p); if ((i = smt_test())) return i; if ((i = io_test())) return i; if ((i = u8v_test(&ma))) return i; if ((i = esm_test(&ma))) return i; l_ma_finish: ui = hbs1_ma_finish(&ma); printf("- ma.finish: %s\n", hbs1_status_name(ui)); if (ui) return 1; return 0; }