From fd1978243a5085594d8926261fd66a14f14fdd9a Mon Sep 17 00:00:00 2001 From: tqcq <99722391+tqcq@users.noreply.github.com> Date: Tue, 5 Dec 2023 17:18:53 +0800 Subject: [PATCH] feature add types test --- tests/CMakeLists.txt | 3 +-- tests/src/ulib/base/types_test.cpp | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tests/src/ulib/base/types_test.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index ff59666..5903c99 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,8 +2,7 @@ set(CMAKE_CXX_STANDARD 98) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(ulib_test - src/ulib/sigslot/sigslot_test.cpp) - + src/ulib/base/types_test.cpp) target_link_libraries(ulib_test PRIVATE ulib gtest diff --git a/tests/src/ulib/base/types_test.cpp b/tests/src/ulib/base/types_test.cpp new file mode 100644 index 0000000..4189275 --- /dev/null +++ b/tests/src/ulib/base/types_test.cpp @@ -0,0 +1,27 @@ +// +// Created by tqcq on 2023/12/5. +// + +#include +#include + +TEST(ULIB_BASE_TYPES, SIZE_OF) +{ + EXPECT_EQ(sizeof(ulib::int8_t), sizeof(char)); + EXPECT_EQ(sizeof(ulib::int16_t), sizeof(short)); + EXPECT_EQ(sizeof(ulib::int32_t), sizeof(int)); + EXPECT_EQ(sizeof(ulib::int64_t), sizeof(long long)); + EXPECT_EQ(sizeof(ulib::uint8_t), sizeof(unsigned char)); + EXPECT_EQ(sizeof(ulib::uint16_t), sizeof(unsigned short)); + EXPECT_EQ(sizeof(ulib::uint32_t), sizeof(unsigned int)); + EXPECT_EQ(sizeof(ulib::uint64_t), sizeof(unsigned long long)); + + EXPECT_EQ(sizeof(ulib::int8_t), 1); + EXPECT_EQ(sizeof(ulib::int16_t), 2); + EXPECT_EQ(sizeof(ulib::int32_t), 4); + EXPECT_EQ(sizeof(ulib::int64_t), 8); + EXPECT_EQ(sizeof(ulib::uint8_t), 1); + EXPECT_EQ(sizeof(ulib::uint16_t), 2); + EXPECT_EQ(sizeof(ulib::uint32_t), 4); + EXPECT_EQ(sizeof(ulib::uint64_t), 8); +} \ No newline at end of file