int main(void) { sd_rtnl *rtnl; sd_rtnl_message *m; sd_rtnl_message *r; char *string_data; int if_loopback; uint16_t type; test_match(); test_multiple(); test_route(); test_container(); assert_se(sd_rtnl_open(&rtnl, 0) >= 0); assert_se(rtnl); if_loopback = (int) if_nametoindex("lo"); assert_se(if_loopback > 0); test_async(if_loopback); test_pipe(if_loopback); test_event_loop(if_loopback); test_link_configure(rtnl, if_loopback); test_get_addresses(rtnl); assert_se(sd_rtnl_message_new_link(rtnl, &m, RTM_GETLINK, if_loopback) >= 0); assert_se(m); assert_se(sd_rtnl_message_get_type(m, &type) >= 0); assert_se(type == RTM_GETLINK); assert_se(sd_rtnl_message_read_string(m, IFLA_IFNAME, &string_data) == -EPERM); assert_se(sd_rtnl_call(rtnl, m, 0, &r) == 1); assert_se(sd_rtnl_message_get_type(r, &type) >= 0); assert_se(type == RTM_NEWLINK); assert_se((r = sd_rtnl_message_unref(r)) == NULL); assert_se(sd_rtnl_call(rtnl, m, -1, &r) == -EPERM); assert_se((m = sd_rtnl_message_unref(m)) == NULL); assert_se((r = sd_rtnl_message_unref(r)) == NULL); test_link_get(rtnl, if_loopback); test_address_get(rtnl, if_loopback); assert_se(sd_rtnl_flush(rtnl) >= 0); assert_se((m = sd_rtnl_message_unref(m)) == NULL); assert_se((r = sd_rtnl_message_unref(r)) == NULL); assert_se((rtnl = sd_rtnl_unref(rtnl)) == NULL); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { int viz = 1; // Memento_setParanoia(1); if (argc > 1) while (++argv, --argc) { if (strcmp(argv[0], "-viz") == 0) viz = 1; else if (strcmp(argv[0], "-noviz") == 0) viz = 0; else { fprintf(stderr, "Unrecognised option: '%s'\n", argv[0]); exit(EXIT_FAILURE); } } (void) queuetest(); test_container(viz); return EXIT_SUCCESS; }
int main() { std::vector<int> v; v.push_back(1); std::array<int, 1> a; a[0] = 3; std::initializer_list<int> il = { 4 }; test_container ( v ); test_container ( a ); test_container ( il ); test_const_container ( v ); test_const_container ( a ); test_const_container ( il ); static constexpr int arrA [] { 1, 2, 3 }; test_const_array ( arrA ); }
int main(int argc , char ** argv) { const char * config_file = argv[1]; ert_test_context_type * context = ert_test_context_alloc( "OBS_VECTOR_FS" , config_file); enkf_main_type * enkf_main = ert_test_context_get_main( context ); { test_valid_obs_vector( enkf_main , "WWCT:OP_3"); test_container( context ); test_measure( context ); test_invalid_obs_vector( enkf_main , "GOPT:OP"); } ert_test_context_free( context ); }
int main(int argc , char ** argv) { util_install_signals(); { const char * config_file = argv[1]; ert_test_context_type * test_context = ert_test_context_alloc( "ENKF_OBS_FS" , config_file ); { testS( test_context ); test_iget( test_context ); test_container( test_context ); } ert_test_context_free( test_context ); exit(0); } }
int main() { int ret = 0; printf("LIBCDF_VERSION:%s\n",LIBCDF_VERSION); register_all_lib_modules(); debugger_gp = debugger_creator("dbg.ini",0); debugger_init(debugger_gp); dbg_str(DBG_DETAIL,"debugger is start up"); test_container(); test_datastructure(); test_analyzer(); dbg_str(DBG_DETAIL,"test end"); return ret; }
int _tmain(int argc, _TCHAR* argv[]) { LOG_F("xTest main(), 测试 \n"); int arg = 1018; switch(arg) { case 1000: { test_util_ex(); }break; case 1: { test_util(); }break; case 2: { test_container(); }break; case 3: { test_thread(); }break; case 4: { test_net(true); }break; case 5: { test_boost(); }break; case 6: { test_kbe(); }break; case 1001: { test_db(); }break; case 1002: { test_math(); }break; case 1003: { test_design(); }break; case 1005: { //test_net(false); test_async(true); }break; case 1006: { test_lua(); }break; case 1007: { test_js(); }break; case 1008: { test_proto(); }break; case 1010: { test_graph(); }break; case 1011: { test_graph_d3d(); }break; case 1013: { test_cv(); }break; case 1015: { test_battle(); }break; case 1016: { test_hacker(); }break; case 1017: { test_yh(); }break; case 1018: { test_ai(); } case 1900: { test_tool(); }break; default: { MainEx(argc, argv); }break; } // { // int n = X::Init(NULL); // LOGD_F(" n = %d", n); // // X_HSER->Init(); // X_HSER->Start(); // // X_HSER->Stop(); // X_HSER->Destroy(); // } // { // // [4/26/2015 Administrator] // HINSTANCE hnst=LoadLibrary(_T("xService.dll")); // FreeLibrary(hnst); // // HINSTANCE hnst2=LoadLibrary(_T("xService.dll")); // FreeLibrary(hnst); // // } LOG_F("xTest main(), end"); while(true) { X::Sleep_f(1); } return 0; }
static void test_heap(void) { struct mock_pop *mpop = MMAP_ANON_ALIGNED(MOCK_POOL_SIZE, Ut_mmap_align); PMEMobjpool *pop = &mpop->p; memset(pop, 0, MOCK_POOL_SIZE); pop->heap_offset = (uint64_t)((uint64_t)&mpop->heap - (uint64_t)mpop); pop->p_ops.persist = obj_heap_persist; pop->p_ops.memset_persist = obj_heap_memset_persist; pop->p_ops.base = pop; pop->set = MALLOC(sizeof(*(pop->set))); pop->set->options = 0; pop->set->directory_based = 0; struct stats *s = stats_new(pop); UT_ASSERTne(s, NULL); void *heap_start = (char *)pop + pop->heap_offset; uint64_t heap_size = MOCK_POOL_SIZE - sizeof(PMEMobjpool); struct palloc_heap *heap = &pop->heap; struct pmem_ops *p_ops = &pop->p_ops; UT_ASSERT(heap_check(heap_start, heap_size) != 0); UT_ASSERT(heap_init(heap_start, heap_size, &pop->heap_size, p_ops) == 0); UT_ASSERT(heap_boot(heap, heap_start, heap_size, &pop->heap_size, pop, p_ops, s, pop->set) == 0); UT_ASSERT(heap_buckets_init(heap) == 0); UT_ASSERT(pop->heap.rt != NULL); test_alloc_class_bitmap_correctness(); test_container((struct block_container *)container_new_ravl(heap), heap); test_container((struct block_container *)container_new_seglists(heap), heap); struct alloc_class *c_small = heap_get_best_class(heap, 1); struct alloc_class *c_big = heap_get_best_class(heap, 2048); UT_ASSERT(c_small->unit_size < c_big->unit_size); /* new small buckets should be empty */ UT_ASSERT(c_big->type == CLASS_RUN); struct memory_block blocks[MAX_BLOCKS] = { {0, 0, 1, 0}, {0, 0, 1, 0}, {0, 0, 1, 0} }; struct bucket *b_def = heap_bucket_acquire_by_id(heap, DEFAULT_ALLOC_CLASS_ID); for (int i = 0; i < MAX_BLOCKS; ++i) { heap_get_bestfit_block(heap, b_def, &blocks[i]); UT_ASSERT(blocks[i].block_off == 0); } heap_bucket_release(heap, b_def); struct memory_block old_run = {0, 0, 1, 0}; struct memory_block new_run = {0, 0, 0, 0}; struct alloc_class *c_run = heap_get_best_class(heap, 1024); struct bucket *b_run = heap_bucket_acquire(heap, c_run); /* * Allocate blocks from a run until one run is exhausted. */ UT_ASSERTne(heap_get_bestfit_block(heap, b_run, &old_run), ENOMEM); int *nresv = bucket_current_resvp(b_run); do { new_run.chunk_id = 0; new_run.block_off = 0; new_run.size_idx = 1; UT_ASSERTne(heap_get_bestfit_block(heap, b_run, &new_run), ENOMEM); UT_ASSERTne(new_run.size_idx, 0); *nresv = 0; } while (old_run.block_off != new_run.block_off); *nresv = 0; heap_bucket_release(heap, b_run); stats_delete(pop, s); UT_ASSERT(heap_check(heap_start, heap_size) == 0); heap_cleanup(heap); UT_ASSERT(heap->rt == NULL); FREE(pop->set); MUNMAP_ANON_ALIGNED(mpop, MOCK_POOL_SIZE); }
int main(void) { sd_rtnl *rtnl; sd_rtnl_message *m; sd_rtnl_message *r; void *data; int if_loopback; uint16_t type; unsigned int mtu = 0; unsigned int *mtu_reply; test_multiple(); test_route(); test_container(); assert(sd_rtnl_open(0, &rtnl) >= 0); assert(rtnl); if_loopback = (int) if_nametoindex("lo"); assert(if_loopback > 0); test_async(if_loopback); test_pipe(if_loopback); test_event_loop(if_loopback); test_link_configure(rtnl, if_loopback); assert(sd_rtnl_message_link_new(RTM_GETLINK, if_loopback, 0, 0, &m) >= 0); assert(m); assert(sd_rtnl_message_get_type(m, &type) >= 0); assert(type == RTM_GETLINK); assert(sd_rtnl_message_read(m, &type, &data) == 0); assert(sd_rtnl_call(rtnl, m, 0, &r) == 1); assert(sd_rtnl_message_get_type(r, &type) >= 0); assert(type == RTM_NEWLINK); assert(sd_rtnl_message_read(m, &type, &data) == 0); assert((r = sd_rtnl_message_unref(r)) == NULL); assert(sd_rtnl_call(rtnl, m, -1, &r) == -EPERM); assert((m = sd_rtnl_message_unref(m)) == NULL); assert((r = sd_rtnl_message_unref(r)) == NULL); assert(sd_rtnl_message_link_new(RTM_GETLINK, if_loopback, 0, 0, &m) >= 0); assert(m); assert(sd_rtnl_message_append(m, IFLA_MTU, &mtu) >= 0); assert(sd_rtnl_message_read(m, &type, (void **) &mtu_reply) == 1); assert(type == IFLA_MTU); assert(*mtu_reply == 0); assert(sd_rtnl_message_read(m, &type, &data) == 0); assert(sd_rtnl_call(rtnl, m, -1, &r) == 1); while (sd_rtnl_message_read(r, &type, &data) > 0) { switch (type) { // case IFLA_MTU: // assert(*(unsigned int *) data == 65536); // break; // case IFLA_QDISC: // assert(streq((char *) data, "noqueue")); // break; case IFLA_IFNAME: assert(streq((char *) data, "lo")); break; } } assert(sd_rtnl_flush(rtnl) >= 0); assert((m = sd_rtnl_message_unref(m)) == NULL); assert((r = sd_rtnl_message_unref(r)) == NULL); assert((rtnl = sd_rtnl_unref(rtnl)) == NULL); return EXIT_SUCCESS; }