diff --git a/CMakeLists.txt b/CMakeLists.txt index e4430af..60d5931 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,6 +11,8 @@ find_package(OpenSSL 1.1.1 REQUIRED) include_directories(${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${SQLiteCpp_INCLUDE_DIRS}) +enable_testing() + add_subdirectory(src) add_subdirectory(test) \ No newline at end of file diff --git a/include/debug_tools/print_tools.h b/include/debug_tools/print_tools.h index 548764e..f128306 100644 --- a/include/debug_tools/print_tools.h +++ b/include/debug_tools/print_tools.h @@ -27,7 +27,7 @@ namespace Net { void printRed(string red_info); - void printInfo(const string& info, string tag = ""); + void printInfo(const string& info, const string& tag = ""); void printInfoBuffer(const string& info, const string& tag = ""); diff --git a/src/debug_tools/print_tools.cpp b/src/debug_tools/print_tools.cpp index 072ab80..b84cd25 100644 --- a/src/debug_tools/print_tools.cpp +++ b/src/debug_tools/print_tools.cpp @@ -24,9 +24,9 @@ namespace Net { printf("\033[31m%s\n\033[0m", red_info.data()); } - void printInfo(const string& info, string &tag) { + void printInfo(const string& info, const string& tag) { printf("[DEBUG INFO] %s ", info.data()); - if(tag.size()) + if(!tag.empty()) printf("{ %s }\n",tag.data()); } diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index c2e71bb..be848b2 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -1 +1,3 @@ -add_library(utils STATIC rsa_key_chain.cpp) \ No newline at end of file +add_library(utils STATIC rsa_key_chain.cpp) + +target_link_libraries(utils debugTools ssl crypto) \ No newline at end of file diff --git a/test/test_util/CMakeLists.txt b/test/test_util/CMakeLists.txt index 6925f9a..22e7f6b 100644 --- a/test/test_util/CMakeLists.txt +++ b/test/test_util/CMakeLists.txt @@ -1,9 +1,9 @@ -add_executable(testUtils main.cpp) +add_executable(testUtils main.cpp test_rsa.cpp) message(${GTEST_LIBS}) -link_libraries(testUtils utils debugTools ${GTEST_LIBS}) +target_link_libraries(testUtils utils debugTools ${GTEST_LIBS}) add_test(Name testUtils COMMAND testUtils) \ No newline at end of file diff --git a/test/test_util/test_rsa.cpp b/test/test_util/test_rsa.cpp index 79dc25c..ac443b4 100644 --- a/test/test_util/test_rsa.cpp +++ b/test/test_util/test_rsa.cpp @@ -21,7 +21,8 @@ TEST(RSATest, init_test_1) { TEST(RSATest, generate_test_1) { env->rsa->generateKeyPair(); - printTools::printInfo(to_string(env->rsa->getBufferSize()), string("Buffer Size")); + string data = std::to_string(env->rsa->getBufferSize()); + printTools::printInfo(data, "Buffer Size"); } TEST(RSATest, pub_encrypt_test_1) {