Skip to content

Add C++ unit tests for tensor_momentum library#1119

Open
cstollmeta wants to merge 1 commit intomainfrom
export-D95466235
Open

Add C++ unit tests for tensor_momentum library#1119
cstollmeta wants to merge 1 commit intomainfrom
export-D95466235

Conversation

@cstollmeta
Copy link
Copy Markdown
Contributor

Summary:
Adds 42 GoogleTest cases in cpp_test/tensor_momentum_test.cpp covering core tensor operations from the tensor_momentum library. The tests cover four of the ten untested source files that have standalone C++ APIs testable without complex Character object setup:

  • tensor_quaternion.h (15 tests): quaternion identity, check validation, split, normalize, conjugate, inverse, multiply (identity and batch), rotate vector, Euler-to-quaternion round-trip, quaternion-to-rotation-matrix round-trip, rotation-matrix-to-quaternion round-trip, blend quaternions, weight normalization
  • tensor_transforms.h (14 tests): identity skeleton state, split skeleton state, quaternion/translation/scale to skeleton state, skeleton state to transforms (identity and translation), multiply skeleton states, transform points (identity, translation, scale, invalid input), inverse skeleton states (with and without rotation), blend skeleton states
  • tensor_kd_tree.h (4 tests): find closest points (exact match, nearest neighbor, max distance filtering), find closest points on mesh (triangle projection)
  • tensor_skinning.h (3 tests): compute vertex normals (simple triangle, invalid input validation, normalization check)

Tests focus on edge cases, numerical precision, and input validation — areas where Python integration tests typically lack coverage. The remaining 6 source files (tensor_blend_shape, tensor_parameter_transform, tensor_skeleton_state, tensor_mppca, tensor_joint_parameters_to_positions, tensor_momentum_utility) require Character/ParameterTransform objects from the momentum library and are better suited for a follow-up with appropriate test fixtures.

Reviewed By: yutingye

Differential Revision: D95466235

Summary:
Adds 42 GoogleTest cases in `cpp_test/tensor_momentum_test.cpp` covering core tensor operations from the tensor_momentum library. The tests cover four of the ten untested source files that have standalone C++ APIs testable without complex Character object setup:

- **tensor_quaternion.h** (15 tests): quaternion identity, check validation, split, normalize, conjugate, inverse, multiply (identity and batch), rotate vector, Euler-to-quaternion round-trip, quaternion-to-rotation-matrix round-trip, rotation-matrix-to-quaternion round-trip, blend quaternions, weight normalization
- **tensor_transforms.h** (14 tests): identity skeleton state, split skeleton state, quaternion/translation/scale to skeleton state, skeleton state to transforms (identity and translation), multiply skeleton states, transform points (identity, translation, scale, invalid input), inverse skeleton states (with and without rotation), blend skeleton states
- **tensor_kd_tree.h** (4 tests): find closest points (exact match, nearest neighbor, max distance filtering), find closest points on mesh (triangle projection)
- **tensor_skinning.h** (3 tests): compute vertex normals (simple triangle, invalid input validation, normalization check)

Tests focus on edge cases, numerical precision, and input validation — areas where Python integration tests typically lack coverage. The remaining 6 source files (tensor_blend_shape, tensor_parameter_transform, tensor_skeleton_state, tensor_mppca, tensor_joint_parameters_to_positions, tensor_momentum_utility) require Character/ParameterTransform objects from the momentum library and are better suited for a follow-up with appropriate test fixtures.

Reviewed By: yutingye

Differential Revision: D95466235
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Mar 10, 2026
@meta-codesync
Copy link
Copy Markdown
Contributor

meta-codesync Bot commented Mar 10, 2026

@cstollmeta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95466235.

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

Labels

CLA Signed This label is managed by the Meta Open Source bot. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant