int main() { test_delegate(); test_custom_factory(); test_template(); return hpx::util::report_errors(); }
int test_staticlink() { char *ptr = "Hello world!"; char *np = 0; int i = 5; unsigned int bs = sizeof(int)*8; int mi; char buf[80]; int a = 0; a = test_global(); // gI = 100 printf("global variable gI = %d", a); if (a == 100) printf(", PASS\n"); else printf(", FAIL\n"); a = select_1(); printf("select_1() = %d\n", a); // a = 1 a = select_2(); printf("select_2() = %d\n", a); // a = 1 a = select_3(); printf("select_3() = %d\n", a); // a = 1 a = test_select_global_pic(); // test global of pic llc -O1 option printf("test_select_global_pic() = %d", a); // a = 100 if (a == 100) printf(", PASS\n"); else printf(", FAIL\n"); a = test_func_arg_struct(); a = test_contructor(); a = test_template(); printf("test_template() = %d", a); // a = 15 if (a == 15) printf(", PASS\n"); else printf(", FAIL\n"); a = test_alloc(); // 31 printf("test_alloc() = %d", a); if (a == 31) printf(", PASS\n"); else printf(", FAIL\n"); a = test_inlineasm(); printf("test_inlineasm() = %d", a); // a = 53 if (a == 53) printf(", PASS\n"); else printf(", FAIL\n"); return 0; }
int main (void) { extern void test_config (void); extern void test_except (void); extern void test_hashtable (void); extern void test_memory (void); extern void test_scanner (void); extern void test_template (void); #ifdef DEBUG_MALLOC GC_find_leak = 1; #endif test_config(); test_except(); test_hashtable(); test_memory(); test_scanner(); test_template(); #ifdef DEBUG_MALLOC CHECK_LEAKS(); #endif return 0; }
int main(int argc, char *argv[]) { biglist_t *entries = NULL; /** Basic Hashing -- statically allocated table */ bighash_table_init_static(&static_table); insert__(&static_table, 10000, &entries); test_table_data__(&static_table, &entries); bighash_table_destroy(&static_table, NULL); /** Basic hashing -- dynamically allocated table */ { bighash_table_t *dtable; dtable = bighash_table_create(64); insert__(dtable, 10000, &entries); test_table_data__(dtable, &entries); bighash_table_destroy(dtable, NULL); } /** Count and removal while iterating */ { bighash_table_t *table; bighash_iter_t iter; bighash_entry_t *e; test_entry_t *te; int ecount=100; int count = 0; table = bighash_table_create(64); insert__(table, ecount, NULL); if(bighash_entry_count(table) != ecount) { AIM_DIE("Entry count mismatch: expected %d, got %d", ecount, bighash_entry_count(table)); } /* Iterate once, just counting */ for(te = (test_entry_t*)bighash_iter_start(table, &iter); te; te = (test_entry_t*)bighash_iter_next(&iter)) { count++; } if(count != ecount) { AIM_DIE("Iteration count incorrect (%d)", count); } /* Iterate again, removing elements. Tests both iteration restart * and remove-while-iterating. */ for(e = bighash_iter_start(table, &iter); e; e = bighash_iter_next(&iter)) { test_entry_t *te = container_of(e, hash_entry, test_entry_t); bighash_remove(table, &te->hash_entry); /* Clear the list links on this element to make sure the * removal was done properly. */ memset(te, 0, sizeof(*te)); aim_free(te); } if(bighash_entry_count(table) != 0) { AIM_DIE("Count is not zero after iterated removal (count=%d)", bighash_entry_count(table)); } bighash_table_destroy(table, NULL); } /** Migrating between tables */ { bighash_table_t *src; bighash_table_t *dst; src = bighash_table_create(64); dst = bighash_table_create(128); insert__(src, 1000, &entries); bighash_entries_move(dst, src); if(bighash_entry_count(src) != 0) { AIM_DIE("Source table is not empty."); } bighash_table_destroy(src, NULL); test_table_data__(dst, &entries); bighash_table_destroy(dst, NULL); } /** Check utilization and automatic element destruction */ bighash_table_init_static(&static_table); insert__(&static_table, 100000, 0); bighash_table_utilization_show(&static_table, &aim_pvs_stdout); bighash_table_destroy(&static_table, free_test_entry); test_template(); return 0; }