Files
cpp-linter-template/tests/test_main.cpp
MH Hung f55d10ee07 feat(linter): implement Phase 1 linter automation and docs
- Add .clang-tidy (analyzer + selected bugprone) and .clang-format (LLVM, 4-space, 100 cols)
- Enhance scripts/run-linter.sh to use compile_commands.json when available
- Add scripts/setup-hooks.sh pre-commit (format enforcement; advisory tidy)
- Update azure-pipelines.yml to export compile_commands and run clang-tidy -p build
- Fill docs/linter-setup.md and docs/coding-standards.md for Phase 1
- Add minimal tests in tests/test_main.cpp to ensure CI executes
- Rewrite README with Phase 1 workflow
2025-09-09 22:52:34 +08:00

22 lines
511 B
C++

#include "utils.h"
#include <iostream>
#include <vector>
int main() {
std::vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
int sum = calculateSum(v);
if (sum != 6) {
std::cerr << "Test failed: expected 6, got " << sum << std::endl;
return 1;
}
if (!isPositive(1) || isPositive(-1)) {
std::cerr << "Test failed: isPositive check" << std::endl;
return 1;
}
std::cout << "All basic tests passed" << std::endl;
return 0;
}