integrate gtest framwork

This commit is contained in:
2024-03-26 04:52:12 +00:00
parent 347cfcf8e9
commit 68d185f12a
5 changed files with 55 additions and 4 deletions

9
map/test/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
add_executable(
test_mp_basic
test_basic.cpp
)
target_link_libraries(
test_mp_basic
GTest::gtest_main
)
gtest_discover_tests(test_mp_basic)

15
map/test/test_basic.cpp Normal file
View File

@ -0,0 +1,15 @@
#include <gtest/gtest.h>
#include "map.hpp"
TEST(BasicTests, GTestItSelf) {
// Expect two strings not to be equal.
EXPECT_STRNE("hello", "world");
// Expect equality.
EXPECT_EQ(7 * 6, 42);
}
TEST(BasicTests, ConstructorAndEmptySize) {
sjtu::map<int, int> map;
EXPECT_EQ(map.empty(), true);
EXPECT_EQ(map.size(), 0);
}