|
FhSim
3.1.0
Marine systems simulation
|
As of 599e1b5, 2026-11-03. This page describes how the library is tested. It does not list per-SimObject coverage: tests/CMakeLists.txt and the TEST names in tests/src are the source of truth.
The gtest binary test_fhsim_base is built from the files listed in tests/CMakeLists.txt:
System-InitSim_Test.cpp, Template-Input_Test.cpp, Engine-*_Test.cpp, Sundials-Consistency_Test.cpp;SimObj-<Name>_Test.cpp per tested SimObject;Connect-*_Test.cpp, which wire two or more SimObjects together;Jacobian-*_Test.cpp, StateFrame_Test.cpp, BodyKinematics6Dof_Test.cpp, CableSegmentStructural*_Test.cpp;Submergence, WaveExcitation, RigidBodyHydro, Cable*, SeabedContact_Pin);OldVsNew_Validation_Test.cpp, reference values of the old FhSim (tests/data).fh_add_gtest_tests registers each gtest case as a ctest test. Which ctest entries exist:
| Entry | Labels | What it runs |
|---|---|---|
fhsim_base | unit | all suites (none has a _VALIDATION suffix; no fhsim_base_validation entry is registered) |
fhsim_base.Cli.Template_Input_Mass | smoke | the FhSim executable on Template-Input_Mass_in.xml |
The timing test CableWaveSums.Cable_timingOfOdeFcnAndOdeJacobianInWaves (BASE-0064) takes well under a second and runs in the unit entry. It prints the time of one OdeFcn and one OdeJacobian; it asserts only that the time is finite. The CLI entry exists because no gtest goes through fhsim::CreateSimulationManagerFromFile.
Test inputs live in tests/in/<ID>/. A test compares its result with a _ref.csv baseline. Most SimObj-*_Test.cpp files use RunAndCompareRegressionXmlTiming from tests/src/TestUtils.h. It reads <Timing TEnd=...> from the input and compares the result.
fhsim::test::TestSpec.jacobianMode (in fhsim) defaults to Auto. A test left at Auto also checks the Jacobian when any SimObject in the scenario reports HasJacobians(). A test can set Yes or No explicitly.
Yes: Jacobian-Ball, Jacobian-Cable, Jacobian-LowPass, Jacobian-NonZeroOffset.No: helper runs without a baseline or with a Jacobian that is checked in another test: SimObj-Body6d_Test.cpp, SimObj-FlukeAnchor_Test.cpp, SimObj-Cable_Test.cpp, OldVsNew_Validation_Test.cpp.The check samples the initial condition and a few perturbed states. A Jacobian term that switches on only away from there (wall contact, a cable going from slack to taut) is not probed by the default check. A dedicated test must cover it.
SimObject.Visual_CameraShot and SimObject.Visual_BillboardArrow in SimObj-Visual_Test.cpp compile only under FH_VISUALIZATION.SimObj-Samplifier_Test.cpp asserts noise statistics, not a _ref.csv.