This commit is contained in:
eson 2020-04-01 00:22:51 +08:00
parent 50d5d5c09f
commit ee6e09acea
5 changed files with 48 additions and 6 deletions

28
.vscode/settings.json vendored
View File

@ -1,3 +1,29 @@
{
"C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools"
"C_Cpp.default.configurationProvider": "vector-of-bool.cmake-tools",
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "googletest.failed",
"settings": {
"foreground": "#f00"
}
},
{
"scope": "googletest.passed",
"settings": {
"foreground": "#0f0"
}
},
{
"scope": "googletest.run",
"settings": {
"foreground": "#0f0"
}
}
]
},
"gtest-adapter.debugConfig": [
"(gdb) gtest bug"
],
"gtest-adapter.supportLocation": true
}

4
.vscode/tasks.json vendored
View File

@ -9,7 +9,7 @@
"command": "/usr/bin/bash",
"args": [
"-c",
"cd ${workspaceFolder}/build && cmake .. && make -j4",
"cd ${workspaceFolder}/build && cmake .. -DCMAKE_BUILD_TYPE=Debug && make -j4",
],
"options": {
"cwd": "/bin"
@ -25,7 +25,7 @@
"command": "/usr/bin/bash",
"args": [
"-c",
"cd ${workspaceFolder}/gtest && mkdir -p build && cd build && cmake .. && make -j4",
"cd ${workspaceFolder}/gtest && mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Debug && make -j4",
],
"options": {
"cwd": "/bin"

View File

@ -1,10 +1,13 @@
cmake_minimum_required(VERSION 3.5.0)
project(orderly VERSION 0.1.0)
SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
include(CTest)
enable_testing()
include(GoogleTest)
include_directories(
${CMAKE_CURRENT_LIST_DIR}/src
/usr/include

View File

@ -1,10 +1,14 @@
enable_testing()
find_package(GTest REQUIRED)
find_package(Threads REQUIRED)
include_directories(
${CMAKE_CURRENT_LIST_DIR}/../src
)
include(GoogleTest)
# include(GoogleTest)
add_executable(vbt_test vbt_test.cpp)
target_link_libraries(
@ -14,4 +18,4 @@ target_link_libraries(
pthread
)
add_test(vbt_test vbt_test)
add_test(NAME vbt_test COMMAND vbt_test)

View File

@ -7,3 +7,12 @@ TEST(vbt_test, put) {
VBTree<int, int> vbt;
vbt.put(0, 0);
}
TEST(vbt_test, get) {
VBTree<int, int> vbt;
vbt.put(0, 0);
vbt.put(1, 1);
int * result;
result = vbt.get(1);
ASSERT_TRUE(*result == 1);
}