feature add new test
Some checks failed
linux-x64-gcc / linux-gcc (push) Failing after 50s
rpcrypto-build / build (Debug, mipsel-openwrt-linux.toolchain.cmake) (push) Failing after 58s
linux-mips64-gcc / linux-gcc-mips64el (push) Failing after 1m4s
rpcrypto-build / build (Debug, hisiv510.toolchain.cmake) (push) Successful in 1m12s
rpcrypto-build / build (Release, himix200.toolchain.cmake) (push) Successful in 1m14s
rpcrypto-build / build (Debug, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Failing after 1m20s
rpcrypto-build / build (Release, mipsel-openwrt-linux-musl.toolchain.cmake) (push) Failing after 1m8s
rpcrypto-build / build (Debug, himix200.toolchain.cmake) (push) Successful in 1m10s
linux-hisiv500-gcc / linux-gcc-hisiv500 (push) Successful in 1m40s
rpcrypto-build / build (Release, hisiv510.toolchain.cmake) (push) Successful in 1m22s
rpcrypto-build / build (Release, mipsel-openwrt-linux.toolchain.cmake) (push) Failing after 1m21s

This commit is contained in:
tqcq 2023-12-11 15:39:44 +08:00
parent a6599e9fdb
commit 15fa29c4c5
4 changed files with 27 additions and 17 deletions

View File

@ -2,8 +2,8 @@ set(CMAKE_CXX_STANDARD 98)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_executable(ulib_test add_executable(ulib_test
src/ulib/base/types_test.cpp ulib/base/types_test.cpp
src/ulib/log/log_test.cpp ulib/log/log_test.cpp
) )
target_link_libraries(ulib_test PRIVATE target_link_libraries(ulib_test PRIVATE
ulib ulib

View File

@ -1,14 +0,0 @@
#include <gtest/gtest.h>
#include <ulib/log/log.h>
static const char* kLogTag = "UnitTest";
TEST(ULIB_LOG_TEST, base_test)
{
ULOG_TRACE(kLogTag, "trace log");
ULOG_DEBUG(kLogTag, "debug log");
ULOG_INFO(kLogTag, "info log");
ULOG_WARN(kLogTag, "warn log");
ULOG_ERROR(kLogTag, "error log");
ULOG_FATAL(kLogTag, "fatal log");
}

View File

@ -2,7 +2,7 @@
// Created by tqcq on 2023/12/5. // Created by tqcq on 2023/12/5.
// //
#include <ulib/base/types.h> #include "ulib/base/types.h"
#include <gtest/gtest.h> #include <gtest/gtest.h>
TEST(ULIB_BASE_TYPES, SIZE_OF) TEST(ULIB_BASE_TYPES, SIZE_OF)

View File

@ -0,0 +1,24 @@
#include <gtest/gtest.h>
#include "ulib/log/log.h"
#include <string.h>
static const char* kLogTag = "UnitTest";
class ULIB_LOG : public testing::Test {
protected:
void SetUp() override {
static const size_t full_file_path_len = strlen(__FILE__);
static const size_t project_file_path_len = strlen("tests/ulib/log/log_test.cpp");
ULOG_SET_STRIPPED_PREFIX_LEN(full_file_path_len - project_file_path_len);
}
};
TEST_F(ULIB_LOG, base_test)
{
ULOG_TRACE(kLogTag, "trace log");
ULOG_DEBUG(kLogTag, "debug log");
ULOG_INFO(kLogTag, "info log");
ULOG_WARN(kLogTag, "warn log");
ULOG_ERROR(kLogTag, "error log");
ULOG_FATAL(kLogTag, "fatal log");
}