From 39b47c36f0de9ee75db02229f277741ca1124a15 Mon Sep 17 00:00:00 2001 From: Peter Conrad Date: Wed, 22 Jul 2015 22:18:12 +0200 Subject: [PATCH] Re-enabled + refactored compress test, added zlib test case --- CMakeLists.txt | 5 ++- tests/all_tests.cpp | 3 ++ tests/compress.cpp | 100 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 tests/all_tests.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f6b19c..eac631a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -351,8 +351,6 @@ target_link_libraries( udt_client fc udt ) add_executable( ecc_test tests/ecc_test.cpp ) target_link_libraries( ecc_test fc ) -#add_executable( test_compress tests/compress.cpp ) -#target_link_libraries( test_compress fc ) #add_executable( test_aes tests/aes_test.cpp ) #target_link_libraries( test_aes fc ${rt_library} ${pthread_library} ) #add_executable( test_sleep tests/sleep.cpp ) @@ -360,6 +358,9 @@ target_link_libraries( ecc_test fc ) #add_executable( test_rate_limiting tests/rate_limiting.cpp ) #target_link_libraries( test_rate_limiting fc ) +add_executable( all_tests tests/all_tests.cpp tests/compress.cpp ) +target_link_libraries( all_tests fc ) + if(WIN32) # add addtional import library on windows platform target_link_libraries( fc PUBLIC crypt32.lib) diff --git a/tests/all_tests.cpp b/tests/all_tests.cpp new file mode 100644 index 0000000..8056ccc --- /dev/null +++ b/tests/all_tests.cpp @@ -0,0 +1,3 @@ +#define BOOST_TEST_MODULE AllTests +#include + diff --git a/tests/compress.cpp b/tests/compress.cpp index d5ad840..a30255e 100644 --- a/tests/compress.cpp +++ b/tests/compress.cpp @@ -1,27 +1,89 @@ +#include + +#include #include #include +#include #include -int main( int argc, char** ) +BOOST_AUTO_TEST_SUITE(compress) + +BOOST_AUTO_TEST_CASE(smaz_test) { - std::string line; - std::getline( std::cin, line ); - while( std::cin && line != "q" ) - { - try { - - std::string compressed = fc::smaz_compress( line ); - std::cout<<"compressed size: "<