TBOX的所有测试代码都在./src/demo
下面,基本上包含所有模块的测试。
demo使用
编译完TBOX后会在./src/demo下面生成一个demo.b的测试程序,用msvc编译出来的为demo.exe
直接运行:./src/demo/demo.b 则会列出所有测试模块:
[demo]: ======================================================================
[demo]: help: echo "name" > ./.demo
[demo]: help: ./demo.b args ...
[demo]: help: or
[demo]: help: ./demo.b name args ...
[demo]: help:
[demo]: help: example: echo "stream" > ./.demo
[demo]: help: example: ./demo.b --help
[demo]: help: example: ./demo.b http://www.xxxxx.com /tmp/a
[demo]: help: example: or
[demo]: help: example: ./demo.b stream http://www.xxxxx.com /tmp/a
[demo]: help:
[demo]: help: name: libc_time
[demo]: help: name: libc_wchar
[demo]: help: name: libc_string
[demo]: help: name: libc_stdlib
[demo]: help: name: libm_float
[demo]: help: name: libm_double
[demo]: help: name: libm_integer
[demo]: help: name: database_sql
[demo]: help: name: xml_reader
[demo]: help: name: xml_writer
[demo]: help: name: xml_document
[demo]: help: name: asio_dns
[demo]: help: name: asio_http
[demo]: help: name: asio_httpd
[demo]: help: name: asio_aiopc
[demo]: help: name: asio_aiopd
[demo]: help: name: asio_aicpc
[demo]: help: name: asio_aicpd
[demo]: help: name: math_fixed
[demo]: help: name: math_random
[demo]: help: name: utils_url
[demo]: help: name: utils_crc
[demo]: help: name: utils_md5
[demo]: help: name: utils_sha
[demo]: help: name: utils_bits
[demo]: help: name: utils_dump
[demo]: help: name: utils_option
[demo]: help: name: utils_base32
[demo]: help: name: utils_base64
[demo]: help: name: other_flv
[demo]: help: name: other_test
[demo]: help: name: other_charset
[demo]: help: name: object_json
[demo]: help: name: object_bin
[demo]: help: name: object_xml
[demo]: help: name: object_bplist
[demo]: help: name: object_xplist
[demo]: help: name: object_dump
[demo]: help: name: stream
[demo]: help: name: stream_null
[demo]: help: name: stream_cache
[demo]: help: name: stream_charset
[demo]: help: name: stream_zip
[demo]: help: name: stream_transfer_pool
[demo]: help: name: stream_async_transfer
[demo]: help: name: stream_async_stream_null
[demo]: help: name: stream_async_stream_cache
[demo]: help: name: stream_async_stream
[demo]: help: name: stream_async_stream_charset
[demo]: help: name: stream_async_stream_zip
[demo]: help: name: string_string
[demo]: help: name: string_static_string
[demo]: help: name: memory_check
[demo]: help: name: memory_pool
[demo]: help: name: memory_fixed_pool
[demo]: help: name: memory_large_pool
[demo]: help: name: memory_small_pool
[demo]: help: name: memory_string_pool
[demo]: help: name: memory_memops
[demo]: help: name: memory_buffer
[demo]: help: name: memory_queue_buffer
[demo]: help: name: memory_static_buffer
[demo]: help: name: memory_impl_static_fixed_pool
[demo]: help: name: network_dns
[demo]: help: name: network_url
[demo]: help: name: network_ipv4
[demo]: help: name: network_http
[demo]: help: name: network_whois
[demo]: help: name: network_spider
[demo]: help: name: network_cookies
[demo]: help: name: network_impl_date
[demo]: help: name: platform_file
[demo]: help: name: platform_lock
[demo]: help: name: platform_path
[demo]: help: name: platform_event
[demo]: help: name: platform_utils
[demo]: help: name: platform_timer
[demo]: help: name: platform_ltimer
[demo]: help: name: platform_atomic
[demo]: help: name: platform_process
[demo]: help: name: platform_barrier
[demo]: help: name: platform_atomic64
[demo]: help: name: platform_processor
[demo]: help: name: platform_backtrace
[demo]: help: name: platform_directory
[demo]: help: name: platform_exception
[demo]: help: name: platform_semaphore
[demo]: help: name: platform_cache_time
[demo]: help: name: platform_thread_pool
[demo]: help: name: platform_thread_store
[demo]: help: name: container_heap
[demo]: help: name: container_hash
[demo]: help: name: container_list
[demo]: help: name: container_queue
[demo]: help: name: container_stack
[demo]: help: name: container_vector
[demo]: help: name: container_list_entry
[demo]: help: name: container_single_list
[demo]: help: name: container_single_list_entry
[demo]: help: name: container_bloom_filter
[demo]: help: name: algorithm_find
[demo]: help: name: algorithm_sort
比较使用的一些测试demo
测试http服务器demo
./src/demo/demo.b asio_httpd /tmp/web/root
测试http爬虫demo
./src/demo/demo.b network_spider http://www.xxxx.com
测试stream下载demo
./src/demo/demo.b stream http://www.xxxx.com /tmp/a
测试async_stream下载demo
./src/demo/demo.b async_stream http://www.xxxx.com /tmp/a
测试dns解析demo
./src/demo/demo.b network_dns www.xxxx.com
测试asio dns解析demo
./src/demo/demo.b asio_dns www.xxxx.com
还有好多好多,具体可以直接进入./src/demo目录浏览下,看下代码,大体都能猜到怎么使用