Skip to content

テストと適合性

architecture contract は design document だけでは維持できません。 public API と focused test の両方が存在する requirement だけを implemented contract として扱います。

architecture requirement と executable evidence の対応は、owning package の focused test と repository-level integration/system test で維持します。 このページは、変更時にどの test layer を選ぶかを説明します。

Unit test と focused test

pure utility と局所 contract は owning package で直接 test します。

  • fibril_sim_core/test/test_schedule.cpp:nominal deadline、grid quantization、no-drift arithmetic
  • fibril_sim_core/test/test_external_input.cpp:commit cut、ordering、recorded commit tick
  • fibril_sim_mujoco/test/test_simulation_builder.cpp:construction、binding、warning、invariant
  • fibril_sim_mujoco/test/test_simulation_instance.cpp:Instance isolation、snapshot、state injection、owner thread
  • fibril_sim_mujoco/test/test_runtime_lifecycle.cpp:fixed 13-phase ordering、fault phase、deferred physical mutation boundary
  • fibril_sim_models/test/test_*_component.cpp:standard Component config、model binding、Device semantics
  • fibril_sim_runtime/test/test_simulation_host.cpp:owner-thread execution と immutable completed frame
  • fibril_sim_runtime/test/test_simulation_connection.cpp:typed IPC contract、control、render state、別 process client
  • fibril_sim_runtime/test/test_simulation_runtime.cpp:ROS 非依存の Host/Server lifetime ownership

Component parameter を追加した場合は「parser が受理する」test だけでは不十分です。 raw source から acquired value、delivery まで parameter が runtime behavior に反映される focused test を置きます。

Minimal bench の用途

reusable behavior は full robot fixture だけで検証しません。 fibril_sim_testing の rangefinder bench、controller SIL bench、standard bench asset を使い、必要な依存だけを持つ fixture を作ります。

full scenario しか test がないと、framework regression と application-specific failure を切り分けられません。 minimal bench は architecture boundary 自体の executable example にもなります。

Record/replay test の役割

reproducibility contract を変更した場合は、同じ input value を再投入するだけでなく commit visibility と trace comparison まで test します。 fibril_sim_testing/test/test_record_replay.cpp は ExternalInput record、MCAP persistence、recorded commit-tick replay、numerical trace comparison を一つの path で確認します。

trace schema を変えた場合は fibril_sim_trace/test/test_mcap_trace.cpp と fibril_sim_diagnostics/test/test_trace_diagnostics.cpp も更新します。

Integration test の役割

ROS boundary は fibril_sim_ros/test/test_ros_bridge.cpp で monotonic /clock、immutable DeviceOutput publish、ingress-only callback を確認します。 rosbag2 path は fibril_sim_ros/test/test_rosbag2_io.cpp で typed round-trip と provenance metadata を確認します。

standard ament-backed Plan construction は fibril_sim_ament/test/test_resource_resolver.cpp で確認します。 ROS frontend が独自の Builder policy を持たずに済むよう、resource resolution、extension composition、standard Plan factory を fibril_sim_ament 側で固定します。

same-host IPC は同一 process の test だけでは完了扱いにしません。 fibril_sim_runtime/test/test_simulation_connection.cpp は別 executable の client を起動し、OS process boundary を越えて typed input/output が成立することも確認します。

rendering は optional dependency なので fibril_sim_render 内で real EGL context を使う test を持ち、core test の前提にはしません。

Architecture acceptance の条件

repository-level acceptance criteria は単一 class ではなく package をまたぐ architecture property を対象にします。 要求ごとの executable evidence は owning package の test と repository-level integration/system test に置き、このページでは同じ一覧を複製しません。

Contract を変更するとき

変更する public contract を先に特定し、同じ contract を説明する docs と test を同じ change set で更新します。 implementation detail だけが変わる場合は machine schema や user docs の version を不用意に上げません。

Manifest、Plan inspection、trace、diagnostic JSON のような machine-readable artifact を breaking change する場合は schema versioning を伴わせます。 message text だけを変更して downstream automation を暗黙に壊す形にはしません。