Skip to content
1 change: 0 additions & 1 deletion testing/.clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
Checks: 'clang-diagnostic-*,clang-analyzer-*,-*,performance-*,bugprone-*,clang-analyzer-*,mpi-*,misc-*,readability-*'
WarningsAsErrors: ''
HeaderFilterRegex: ''
AnalyzeTemporaryDtors: false
FormatStyle: 'file'
CheckOptions:
- key: bugprone-argument-comment.CommentBoolLiterals
Expand Down
28 changes: 28 additions & 0 deletions testing/pre-commit-config-version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,31 @@ repos:
args: [--style=file, --version=16] # to load .clang-format
- id: clang-tidy
args: [--checks=.clang-tidy, --version=16] # path/to/.clang-tidy
- repo: .
rev: HEAD
hooks:
- id: clang-format
args: [--style=file, --version=17]
- id: clang-tidy
args: [--checks=.clang-tidy, --version=17]
- repo: .
rev: HEAD
hooks:
- id: clang-format
args: [--style=file, --version=18]
- id: clang-tidy
args: [--checks=.clang-tidy, --version=18]
- repo: .
rev: HEAD
hooks:
- id: clang-format
args: [--style=file, --version=19]
- id: clang-tidy
args: [--checks=.clang-tidy, --version=19]
- repo: .
rev: HEAD
hooks:
- id: clang-format
args: [--style=file, --version=20]
- id: clang-tidy
args: [--checks=.clang-tidy, --version=20]
4 changes: 3 additions & 1 deletion testing/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ done

failed_cases=`grep -c "Failed" result.txt`

if [ $failed_cases -eq 4 ]; then
echo $failed_cases " cases failed."

if [ $failed_cases -eq 9 ]; then
echo "=============================="
echo "Test cpp-linter-hooks success."
echo "=============================="
Expand Down
8 changes: 8 additions & 0 deletions tests/test_clang_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
('args', 'expected_retval'), (
(['--style=Google'], (0, "")),
(['--style=Google', '--version=16'], (0, "")),
(['--style=Google', '--version=17'], (0, "")),
(['--style=Google', '--version=18'], (0, "")),
(['--style=Google', '--version=19'], (0, "")),
(['--style=Google', '--version=20'], (0, "")),
),
)
def test_run_clang_format_valid(args, expected_retval, tmp_path):
Expand All @@ -23,6 +27,10 @@ def test_run_clang_format_valid(args, expected_retval, tmp_path):
('args', 'expected_retval'), (
(['--style=Google',], 1),
(['--style=Google', '--version=16'], 1),
(['--style=Google', '--version=17'], 1),
(['--style=Google', '--version=18'], 1),
(['--style=Google', '--version=19'], 1),
(['--style=Google', '--version=20'], 1),
),
)
def test_run_clang_format_invalid(args, expected_retval, tmp_path):
Expand Down
8 changes: 8 additions & 0 deletions tests/test_clang_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def generate_compilation_database():
('args', 'expected_retval'), (
(['--checks="boost-*"'], 1),
(['--checks="boost-*"', '--version=16'], 1),
(['--checks="boost-*"', '--version=17'], 1),
(['--checks="boost-*"', '--version=18'], 1),
(['--checks="boost-*"', '--version=19'], 1),
(['--checks="boost-*"', '--version=20'], 1),
),
)
def test_run_clang_tidy_valid(args, expected_retval):
Expand All @@ -31,6 +35,10 @@ def test_run_clang_tidy_valid(args, expected_retval):
('args', 'expected_retval'), (
(['--checks="boost-*"'], 1),
(['--checks="boost-*"', '--version=16'], 1),
(['--checks="boost-*"', '--version=17'], 1),
(['--checks="boost-*"', '--version=18'], 1),
(['--checks="boost-*"', '--version=19'], 1),
(['--checks="boost-*"', '--version=20'], 1),
),
)
def test_run_clang_tidy_invalid(args, expected_retval, tmp_path):
Expand Down
Loading