Skip to content

Commit

Permalink
test: Support GoogleTest
Browse files Browse the repository at this point in the history
  • Loading branch information
calcitem committed Jan 5, 2025
1 parent 85ddaae commit d3956cc
Show file tree
Hide file tree
Showing 62 changed files with 5,804 additions and 521 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,7 @@ settings.ini

# Executable files
src/sanmill
src/test_sanmill

# Sourcetrail files
*.srctrl*
Expand Down Expand Up @@ -445,3 +446,8 @@ out/

# xmake
.xmake/

# Coverage
coverage/
*.gcda
*.gcno
40 changes: 40 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,46 @@
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false
},
{
"name": "Build and Run Console C++",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/src/sanmill",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/src",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "Build Console C++",
"setupCommands": [
{
"description": "Enable pretty-printing for lldb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"name": "Test Console C++",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/src/test_sanmill",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/src",
"environment": [],
"externalConsole": false,
"MIMode": "lldb",
"preLaunchTask": "Test Console C++",
"setupCommands": [
{
"description": "Enable pretty-printing for lldb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
17 changes: 15 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,16 @@
"format": "cpp",
"version": "cpp",
"forward_list": "cpp",
"functional": "cpp"
"functional": "cpp",
"any": "cpp",
"csignal": "cpp",
"memory": "cpp",
"print": "cpp",
"span": "cpp",
"unordered_set": "cpp",
"source_location": "cpp",
"thread": "cpp",
"utility": "cpp"
},
"C_Cpp.default.includePath": [
"${workspaceFolder}/src",
Expand All @@ -245,5 +254,9 @@
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.default.intelliSenseMode": "${default}",
"C_Cpp.default.compilerPath": "/usr/bin/g++",
"cmake.sourceDirectory": "~/Sanmill/src/ui/flutter_app/android/app"
"cmake.sourceDirectory": "~/Sanmill/src/ui/flutter_app/android/app",
"gtest-adapter.debugConfig": [
"Test Console C++"
],
"gtest-adapter.supportLocation": true
}
60 changes: 59 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,64 @@
"message": 5
}
}
},
{
"label": "Build Console C++",
"type": "shell",
"command": "make",
"args": [
"all",
"-j"
],
"options": {
"cwd": "${workspaceFolder}/src"
},
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}/src"],
"pattern": {
"regexp": "^(.*?):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"detail": "Build Console C++ application by running 'make all' in src directory."
},
{
"label": "Test Console C++",
"type": "shell",
"command": "make",
"args": [
"test",
"-j"
],
"options": {
"cwd": "${workspaceFolder}/src"
},
"group": {
"kind": "build",
"isDefault": false
},
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceFolder}/src"],
"pattern": {
"regexp": "^(.*?):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
},
"detail": "Test Console C++ application by running 'make test' in src directory."
}
]
}
}
6 changes: 6 additions & 0 deletions format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ clang-format -i include/*.h
clang-format -i src/ui/qt/*.h
clang-format -i src/ui/qt/*.cpp

#clang-format -i tests/*.h
clang-format -i tests/*.cpp

#clang-format -i tests/perfect/*.h
#clang-format -i tests/perfect/*.cpp

cd src/ui/flutter_app/lib
find . -name "*.dart" | xargs dart format --fix

Expand Down
16 changes: 1 addition & 15 deletions include/config.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
// This file is part of Sanmill.
// Copyright (C) 2019-2025 The Sanmill developers (see AUTHORS file)
//
// Sanmill is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Sanmill is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
// config.h

#ifndef INCLUDE_CONFIG_H_
#define INCLUDE_CONFIG_H_
Expand Down
Loading

0 comments on commit d3956cc

Please sign in to comment.