Add tests for the new Pose class - #888
Conversation
🦋 Changeset detectedLatest commit: 5e404fb The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Claude (@claude) review |
|
Claude finished Micheal Parks (@micheal-parks)'s task in 2m 58s —— View job Review
This is a well-structured test suite. The top-of-file comment explaining why round-trips alone aren't sufficient, and the deliberate use of absolute assertions to pin unit constants, is exactly the right approach. The IssuesTwo coverage gaps worth fixing (see inline comments):
Minor
|
| const pose = new Pose().setFromObject3D(object3D) | ||
|
|
||
| expect(pose.x).toBeCloseTo(1000, 6) | ||
| expect(pose.theta).toBeCloseTo(90, 6) |
There was a problem hiding this comment.
The test name promises "reads position back as millimetres" but only asserts x. y and z go through the same setFromVector3 path (each independently multiplied by M_TO_MM), so a bug like an axis swap would pass undetected here.
| expect(pose.theta).toBeCloseTo(90, 6) | |
| expect(pose.x).toBeCloseTo(1000, 6) | |
| expect(pose.y).toBeCloseTo(2000, 6) | |
| expect(pose.z).toBeCloseTo(3000, 6) | |
| expect(pose.theta).toBeCloseTo(90, 6) |
| it('converts ov_radians into stored degrees', () => { | ||
| const pose = new Pose().setFromFrame({ | ||
| orientation: { type: 'ov_radians', value: { x: 0, y: 0, z: 1, th: Math.PI / 2 } }, | ||
| }) |
There was a problem hiding this comment.
Only theta is checked. The ov_radians path calls ov.copy(frame.orientation.value), which copies x, y, and z too — but a regression that dropped those fields would sail through here. Worth adding the full orientation assertion:
| }) | |
| const pose = new Pose().setFromFrame({ | |
| orientation: { type: 'ov_radians', value: { x: 0, y: 0, z: 1, th: Math.PI / 2 } }, | |
| }) | |
| expect(pose.oX).toBeCloseTo(0, 6) | |
| expect(pose.oY).toBeCloseTo(0, 6) | |
| expect(pose.oZ).toBeCloseTo(1, 6) | |
| expect(pose.theta).toBeCloseTo(90, 6) |
|
Overview
Adds a comprehensive set of unit tests for the new
Poseclass, giving the visualizer's core math library a solid bump in coverage.