simlibs tests#145
Merged
jonyMarino merged 1 commit intomainfrom May 7, 2026
Merged
Conversation
* Fix simlibs test discovery and MSVC assimp build flags * Add pipeline to execute tests on PRs and merge with main * Add new tests for simlibs * Remove unnecesary test script * Update workflow to merge test into 1 action to test on windows * Comment line by line the test for core_sim * Comment line by line already existing tests * feat(physics): implement P1 test coverage for UnrealPhysics, PhysicsWorld, and MatlabPhysics backends - Expand UnrealPhysicsBody tests (gtest_unreal_physics.cpp): * Added InitializeUnrealPhysicsBody test: verify rotor wrench points collected * Added CalculateExternalWrench test: verify wrench aggregation and finiteness * Added WriteRobotData test: verify kinematics propagation to robot * Added SetCallbackSetExternalWrench test: verify callback invoked with valid wrench * Added SetWrenchesOnPhysicsBody test: verify model dispatch to body wrench calculation * Tests use TestUnrealPhysicsBody harness to expose protected members - Enhance PhysicsWorld tests (gtest_physics_world.cpp): * Added SetWrenchesOnPhysicsBodies test: verify wrench dispatch to all physics bodies * This covers the critical P1 gap for physics backend dispatch logic - Create MatlabPhysics test suite (gtest_matlab_physics.cpp): * Added constructor tests for MatlabPhysicsBody (default + from robot) * Added WriteRobotData test: verify kinematics propagation to robot * Added ReadRobotData test: verify robot state extraction for serialization * Added CalculateExternalWrench test: verify rotor wrench aggregation * Added MatlabPhysicsModel constructor and SetWrenchesOnPhysicsBody tests * Coverage focuses on unit-level behavior; integration tests with live Matlab marked as TODO - Update CMakeLists.txt to include gtest_matlab_physics.cpp in physics_gtests target Test results: - All 312 tests pass (100%) - Tests follow established pattern: Arrange/Act/Assert with line-specific inline comments - Comments are test-aware and describe specific code actions (not generic boilerplate) Test coverage improvements: - UnrealPhysics: 2 → 8 test cases (functional coverage of InitializeUnrealPhysicsBody, CalculateExternalWrench, callbacks) - PhysicsWorld: 4 → 5 test cases (explicit SetWrenchesOnPhysicsBodies dispatch test) - MatlabPhysics: 0 → 8 test cases (basic unit coverage of core lifecycle methods) * Refactor Ubuntu CI workflow to build and test SimLibs * Change build and test commands to release version --------- Co-authored-by: Jonathan <jony@iamaisim.com>
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.
Fixes: #
About
This pull request introduces several improvements to the build system, test coverage, and CI workflows for the project. The main changes include enabling and expanding unit tests for
core_sim, adding new test cases, updating CMake configurations for better compatibility, and enhancing CI pipelines for both Windows and Linux environments.Test coverage and new tests:
testsubdirectory incore_simto be included whenBUILD_TESTINGis set, allowing unit tests to be built and run. (core_sim/CMakeLists.txt)core_sim/testsuite, including tests for control mapping, battery, gimbal, tilt, rotor/wheel settings, noise model utilities, and various message types. (core_sim/test/CMakeLists.txt) [1] [2]Actuator,Airspeed, andBarometerby adding structured comments that describe the Arrange-Act-Assert pattern and the purpose of each test. (core_sim/test/gtest_actuator.cpp,core_sim/test/gtest_airspeed.cpp,core_sim/test/gtest_barometer.cpp) [1] [2] [3] [4] [5]Build system improvements:
/EHscto the Assimp external project when building with MSVC, ensuring proper exception handling and avoiding warnings treated as errors. (CMakeLists.txt)CI/CD workflow enhancements:
test_linux_simlibs_debug.yml) to build and testsimlibsin debug mode on Linux, including installation of prerequisites and configuration for Clang 18 compatibility. (.github/workflows/test_linux_simlibs_debug.yml)main, increased the timeout, updated the checkout action, and added a step to runSimLibsdebug tests. (.github/workflows/test_windows.yml) [1] [2]These changes collectively improve the project's reliability, maintainability, and cross-platform support.
How Has This Been Tested?
Screenshots and videos (if appropriate):