Int32_t main(void) { log_msg(LOG_NO_FILE_LINE, "--------SIGNAL LINK STACK TEST--------"); stack_test(STACK_SIGNAL_LINK_LIST); log_msg(LOG_NO_FILE_LINE, "--------DOUBLE LINK STACK TEST--------"); stack_test(STACK_DOUBLE_LINK_LIST); log_msg(LOG_NO_FILE_LINE, "--------CIRCLE LINK STACK TEST--------"); stack_test(STACK_CIRCLE_LINK_LIST); return OK; }
int main(void){ stack o_stack = NULL; stack_test(&o_stack); //clear memory stack_clear(&o_stack); }
int main (void) { jerif_err err_code = jerif_ok; #if STACK_TEST_ENABLE printf("[STACK TEST]\n"); if(stack_test()){ printf("Stack test is FAILED!!!\n\n"); }else{ printf("Stack test is SUCCESS!!!\n\n"); } #endif #if DETECT_FUNC_TEST_ENABLE printf("[DETECTING TEST]\n"); if(detecting_data_test()){ printf("Detecting data test is FAILED!!!\n\n"); }else{ printf("Detecting data test is SUCCESS!!!\n\n"); } #endif #if VALIDATOR_TEST_ENABLE printf("[VALIDATOR TEST]\n"); if(validator_test()){ printf("Validator test is FAILED!!!\n\n"); }else{ printf("Validator test is SUCCESS!!!\n\n"); } #endif return 0; }
void stack_test(char *latest_heap_pointer) { char stack_line[256]; iterations++; sprintf(stack_line, "\nstack pointer: %p", &stack_line[255]); puts(stack_line); char *heap_pointer = (char*)malloc(0x100); if (heap_pointer == NULL) { int diff = (&stack_line[255] - latest_heap_pointer); if (diff > 0x200) { sprintf(stack_line, "\n[WARNING] Malloc failed to allocate memory too soon. There are (0x%x) free bytes", diff); report_iterations(); puts(stack_line); } else { puts("\n[SUCCESS] Stack/Heap collision detected"); report_iterations(); } return; } else { heap_pointer += 0x100; sprintf(line, "heap pointer: %p", heap_pointer); puts(line); } if ((&stack_line[255]) > heap_pointer) { stack_test(heap_pointer); } else { puts("\n[WARNING] The Stack/Heap collision was not detected"); report_iterations(); } }
int main(int argc, char* argv[]) { locker_test(); atomic_test(); spinlock_test(); event_test(); #if !defined(OS_MAC) semaphore_test(); #endif stack_test(); #if defined(OS_WINDOWS) // rtsp_header_range_test(); rtsp_header_session_test(); rtsp_header_rtp_info_test(); rtsp_header_transport_test(); sdp_test(); sdp_a_fmtp_test(); sdp_a_rtpmap_test(); url_test(); unicode_test(); utf8codec_test(); thread_pool_test(); ip_route_test(); //aio_socket_test(); //systimer_test(); system("pause"); #endif return 0; }
CC_NO_SANITIZE static int stack_clear_test(size_t size) { stack_dirty(size); stack_clear(size); return stack_test(size); }
int test(){ printf("test start!\n"); op_test(); mem_test(); stack_test(); file_test(); return 0; }
int main(void) { smr_init(LIBCONTAIN_MIN_HPTRS); hptr_init(); smr_thread_init(); stack_test(); smr_thread_fini(); hptr_fini(); smr_fini(); return 0; }
int main(int argc, char const *argv[]) { if ( argc > 1 ) { if ( 0 == strcmp( "stack", argv[1] ) ) { stack_test( atoi( argv[2] ) ); } else { queue_test( atoi( argv[2] ) ); } } return 0; }
void part_two_describe() { cout<<"******************************************"<<endl; cout<<"* 第二章 C++ STL泛型编程 *"<<endl; cout<<"******************************************"<<endl; cout<<"*(1) 一个简单的测试案例 *"<<endl; cout<<"*(2) vector向量容器 *"<<endl; cout<<"*(3) string基本字符系列容器 *"<<endl; cout<<"*(4) set集合容器 *"<<endl; cout<<"*(5) mutiset多种集合容器 *"<<endl; cout<<"*(6) map映照容器 *"<<endl; cout<<"*(7) mutimap多重映照容器 *"<<endl; cout<<"*(8) deque双端队列容器 *"<<endl; cout<<"*(9) list双向链表容器 *"<<endl; cout<<"*(10)bitset位集合容器 *"<<endl; cout<<"*(11)stack堆栈容器 *"<<endl; cout<<"*(12)queue队列容器 *"<<endl; cout<<"*(13)priority_queue优先队列容器 *"<<endl; cout<<"******************************************"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; int num; cin>>num; while(num!=0&&num!=1&&num!=2&&num!=3&&num!=4&&num!=5&&num!=6&&num!=7&&num!=8&&num!=9&&num!=10&&num!=11&&num!=12&&num!=13){ cout<<"编号不存在"<<endl; cout<<"请输入对应的编号进入相应的题目(返回上级输入0):"<<endl; cin>>num; } switch(num){ case 0:total_describe();break; case 1:test();break; case 2:vector_test();break; case 3:string_test();break; case 4:set_test();break; case 5:multiset_test();break; case 6:map_test();break; case 7:multimap_test();break; case 8:deque_test();break; case 9:list_test();break; case 10:bitset_test();break; case 11:stack_test();break; case 12:queue_test();break; case 13:priority_queue_test();break; } }
/** Performs all tests of the util library */ static void test_util() { int i; say( L"Testing utility library" ); for( i=0; i<18; i++ ) { long t1, t2; pq_test( 1<<i ); stack_test( 1<<i ); t1 = get_time(); hash_test( 1<<i ); t2 = get_time(); if( i > 8 ) say( L"Hashtable uses %f microseconds per element at size %d", ((double)(t2-t1))/(1<<i), 1<<i ); al_test( 1<<i ); } sb_test(); /* int i; for( i=2; i<10000000; i*=2 ) { printf( "%d", i ); t1 = get_time(); if(!hash_test(i)) exit(0); t2 = get_time(); printf( " %d\n", (t2-t1)/i ); } */ }
/** * * @brief Perform all selected benchmarks * * @return N/A */ void main(void) { int continuously = 0; int test_result; init_output(&continuously); bench_test_init(); do { fprintf(output_file, sz_module_title_fmt, "Nanokernel API test"); fprintf(output_file, sz_kernel_ver_fmt, sys_kernel_version_get()); fprintf(output_file, "\n\nEach test below is repeated %d times;\n" "average time for one iteration is displayed.", NUMBER_OF_LOOPS); test_result = 0; test_result += sema_test(); test_result += lifo_test(); test_result += fifo_test(); test_result += stack_test(); if (test_result) { /* sema/lifo/fifo/stack account for 12 tests in total */ if (test_result == 12) { fprintf(output_file, sz_module_result_fmt, sz_success); } else { fprintf(output_file, sz_module_result_fmt, sz_partial); } } else { fprintf(output_file, sz_module_result_fmt, sz_fail); } TC_PRINT_RUNID; } while (continuously && !kbhit()); output_close(); }
int main (void) { char c; initial_stack_p = &c; initial_heap_p = (char*)malloc(1); if (initial_heap_p == NULL) { printf("Unable to malloc a single byte\n"); notify_completion(false); } printf("Initial stack/heap geometry:\n"); printf(" stack pointer:V %p\n", initial_stack_p); printf(" heap pointer :^ %p\n", initial_heap_p); initial_heap_p++; stack_test(initial_heap_p); notify_completion(true); }
int main() { fixed_mem_test(); mem_range_test(); mem_range_with_delete(); alloc_test(); memalign_alloc_test(); #ifndef WIN32 stack_test(); #endif CTEST_EXIT(); return 0; }
void runTests() { stack_test(); }
int main(int argc, char* argv[]) { #if defined(OS_LINUX) struct sigaction sa; sa.sa_handler = SIG_IGN; sigaction(SIGCHLD, &sa, 0); sigaction(SIGPIPE, &sa, 0); #endif heap_test(); rbtree_test(); timer_test(); socket_test(); locker_test(); atomic_test(); #if defined(ATOMIC_TEST) atomic_test2(); #endif spinlock_test(); event_test(); #if !defined(OS_MAC) semaphore_test(); #endif onetime_test(); bits_test(); stack_test(); time64_test(); base64_test(); bitmap_test(); hweight_test(); ring_buffer_test(); uri_parse_test(); #if defined(HTTP_TEST) http_test(); #endif thread_pool_test(); task_queue_test(); ip_route_test(); aio_socket_test_cancel(); aio_socket_test(); aio_socket_test2(); aio_socket_test3(); aio_socket_test4(); #if defined(OS_WINDOWS) unicode_test(); utf8codec_test(); systimer_test(); system("pause"); #endif return 0; }
int main() { stack_test(); return 0; }