Skip to content

feat: add native C++ unit tests for state tracking logic#120

Open
tomkp wants to merge 12 commits intomasterfrom
feat/native-cpp-tests-119
Open

feat: add native C++ unit tests for state tracking logic#120
tomkp wants to merge 12 commits intomasterfrom
feat/native-cpp-tests-119

Conversation

@tomkp
Copy link
Copy Markdown
Owner

@tomkp tomkp commented Feb 25, 2026

Summary

Adds native C++ unit tests for the Issue #111 state tracking logic using Catch2.

  • Extracts state detection logic into pure function DetectCardStateChange
  • Adds Catch2 test framework (header-only, v2.13.10)
  • Adds 6 unit tests covering all state transitions
  • Refactors reader_monitor.cpp to use the extracted function
  • Adds CI step to run native tests on all platforms

Closes #119

Changes

New files:

  • src/reader_state_utils.h - Pure function for card state detection
  • src/test/catch.hpp - Catch2 test framework
  • src/test/test_main.cpp - Catch2 main entry point
  • src/test/reader_state_utils_test.cpp - Unit tests

Modified files:

  • binding.gyp - Added test target
  • package.json - Added test:native script
  • src/reader_monitor.cpp - Refactored to use DetectCardStateChange
  • .github/workflows/test.yml - Added native test CI step

Test plan

  • All 6 native C++ tests pass
  • All 106 TypeScript unit tests pass
  • Build succeeds locally
  • CI passes on all platforms (Ubuntu, macOS, Windows)

@tomkp
Copy link
Copy Markdown
Owner Author

tomkp commented Feb 26, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add native C++ unit tests for Issue #111 state tracking logic

1 participant