test: DriverSuper 送信系・途絶監視・厳格フレーム探索のテストを追加#484
Open
sksat (sksat) wants to merge 1 commit into
Open
Conversation
Follow-up to the DriverSuper unit tests: coverage measurement showed the tx path, rx/tlm disruption monitoring and strict frame search were completely untested (the HAL tx recorder and time-advance mock hooks existed but were never used). Add 18 cases: - CDS_send_general_cmd / CDS_send_req_tlm_cmd: HAL frame content, send_status (OK / DISABLE / TX_ERR / VALIDATE_ERR), counters, tx time, and the req_tlm_cmd_tx_count_after_last_tx reset on frame fix - rx disruption: LOST after threshold, OK within, OK when unmonitored - tlm disruption (per stream): LOST after threshold, OK with recent fix - strict frame search: validation requires a header; an overlapped header inside a fixed frame is found in strict mode and skipped in normal mode mock_hal gains tx-result injection (mock_hal_set_tx_result) for the TX_ERR path. driver_super.c line coverage: 67.8% -> 82.4%; remaining untested code is trivial getters/disablers and the CCP converters to be split in #483. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
DriverSuper(component_driver/driver_super.c)の未カバー領域だった「送信系」「受信/テレメ途絶監視」「厳格フレーム探索」を、既存のC++/GoogleTestベースの単体テスト基盤に追加してカバレッジを補完するPRです(#473 のフォローアップ)。
Changes:
- 送信API(
CDS_send_general_cmd/CDS_send_req_tlm_cmd)のユニットテストを新規追加 - 厳格フレーム探索(strict frame search)と、rx/tlm途絶監視のユニットテストを追加
- HALモックにTX戻り値注入(エラー経路用)のフックを追加し、CMakeに新規テストを登録
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| component_driver/tests/test_send.cpp | 送信系のテスト(送信成功/無効stream/no-op/TX_ERR/VALIDATE_ERR/req_tlmカウンタ挙動)を新規追加 |
| component_driver/tests/test_frame_analysis.cpp | strict frame search の挙動と rx/tlm 途絶監視のテストケースを追加 |
| component_driver/tests/mocks/mock_hal_handler_registry.h | mock_hal_set_tx_result() を公開してTXエラー注入を可能化 |
| component_driver/tests/mocks/mock_hal_handler_registry.c | TXエラー注入(返り値差し替え)を実装 |
| component_driver/tests/CMakeLists.txt | 新規 test_send ターゲットを追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
モチベーション
#473 の検証(gcov 計測)で、送信系・受信/テレメ途絶監視・厳格フレーム探索が完全に未テストであることが判明した(HAL の tx 記録や時刻制御の mock フックは用意されていたのに未使用だった)。この follow-up でそれらを埋める。
追加テスト(18 ケース、合計 93 + DISABLED 1)
送信系(
test_send.cpp新規、10 ケース)CDS_send_general_cmd: HAL に届くフレーム内容・send_status(OK / DISABLE / TX_ERR / VALIDATE_ERR)・カウンタ・送信時刻CDS_send_req_tlm_cmd: カウンタ 2 種、req_tlm_cmd_tx_count_after_last_txがテレメフレーム確定でリセットされる仕様の検証受信途絶・テレメ途絶監視(
test_frame_analysis.cppに 5 ケース)厳格フレーム探索(同 3 ケース)
mock の拡張
mock_hal_set_tx_result(): HAL tx の返り値注入(TX_ERR 経路用)カバレッジ
Test plan
cargo test -p c2a-core-component-driverで 93 ケース pass(32bit ビルド)🤖 Generated with Claude Code