make build: Compile source files (release)make test: Run test suitemake lint: Run clippy (-D warnings)make fmt-check: Verify formattingmake ci: Run build/lint/format/test checksmake clean: Remove generated files
- Documentation:
doc/
Core Philosophy: Tests are the specification. Correctness is ensured by writing tests that describe expected behavior before implementation.
- RED (Failing Test): Write a test describing the expected behavior. Run it to confirm it fails.
- GREEN (Minimal Code): Write just enough code to make the test pass.
- REFACTOR (Improve): Clean up and optimize the code while keeping tests green.
Critical Rule: Never skip steps. Never write implementation code without a failing test first.
- Adding a New Feature:
- Create or open the corresponding test file.
- Write a test for the new behavior (must fail).
- Run
make testto confirm the expected error. - Implement minimal code in the source file.
- Run
make testto confirm passage. - Refactor if needed.
- Fixing a Bug:
- Write a test that reproduces the bug (must fail/crash).
- Fix the bug in the source.
- Run
make testto confirm the fix and ensure no regressions.
- Refactoring:
- Ensure all existing tests pass.
- Refactor code.
- Run
make testto ensure all tests still pass.
-
Assertion Pattern: Use assertions that compare
actualvsexpectedwith a clear message format:"function-name: concise description of expectation". -
Scope: Test observable behavior (return values, side effects) rather than internal state or private variables.
-
Mocking Strategy:
-
Mock external dependencies and environment APIs before requiring the module under test.
-
Use mocks to simulate edge cases and inputs without relying on the real environment.
-
Coverage Checklist:
-
All public functions have tests.
-
Edge cases tested (nil, empty input, invalid input).
-
Error conditions handled and tested.
- DO NOT write code before tests.
- DO NOT require/load the module under test before setting up its mocks (dependencies must be mocked first).
- DO NOT test implementation details (e.g., internal counters); test the public API results instead.
- Commit Messages: English
- PR Titles/Descriptions: English