Skip to main content

sqlitecpp-testing-practices

GoogleTest patterns and testing practices for SQLiteCpp test coverage and structure.

소스 정보

저장소
SRombauts/SQLiteCpp
최근 소스 활동
2026년 5월 19일 21:46
감지된 SKILL.md 언어
영어
스타
2,789
포크
575

설치 방법

기본적으로 소스를 먼저 확인하는 Prompt가 선택됩니다. 직접 명령으로 전환하거나 로컬 사본을 다운로드할 수도 있습니다.

소스 파일 검토

설치 여부를 결정하기 전에 SKILL.md와 SkillsMP에 표시된 보조 파일을 읽어 보세요.

SKILL.md 표시 중

SKILL.md
소스 지침 · 읽기 전용 미리보기
name
sqlitecpp-testing-practices
description
GoogleTest patterns and testing practices for SQLiteCpp test coverage and structure.
# SQLiteCpp Testing Practices ## Scope - Uses GoogleTest (system if found, otherwise `googletest/` fallback). - Test files live in `tests/*_test.cpp` (see `tests/Database_test.cpp`). - File headers use `@ingroup tests`. ## Test File Structure ```cpp #include <gtest/gtest.h> #include <SQLiteCpp/Database.h> TEST(DatabaseTest, CanOpenReadWriteDatabase) { // Arrange: setup test database SQLite::Database db(":memory:", SQLite::OPEN_READWRITE | SQLite::OPEN_CREATE); // Act: perform operation db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY)"); // Assert: verify behavior EXPECT_EQ(1, db.exec("INSERT INTO test DEFAULT VALUES")); } ``` ## Adding a New Test File - Create `tests/NewClass_test.cpp`. - Register it in `CMakeLists.txt` under `SQLITECPP_TESTS`. - Register it in `meson.build` under `sqlitecpp_test_srcs`. ## Common Patterns - Prefer `:memory:` databases when possible. - Use file-based databases when testing file I/O behavior (see `tests/Database_test.cpp`). - Use `TEST()` for independent tests; use `TEST_F()` only when a shared fixture is needed. ## Running Tests ```bash # CMake (from build dir) ctest --output-on-failure bin/SQLiteCpp_tests --gtest_filter=Database.* # Meson meson test -C builddir meson test -C builddir --test-args="--gtest_filter=Database.*" ``` ## Canonical References - Test style: `tests/Database_test.cpp` - CMake test list: `CMakeLists.txt` (`SQLITECPP_TESTS`) - Meson test list: `meson.build` (`sqlitecpp_test_srcs`) ## Cross-References - Workflow checklist: `sqlitecpp-workflow` - Build configuration: `sqlitecpp-build-cmake`, `sqlitecpp-build-meson`
GitHub에서 보기