Add truth extensions for Measure, and add isNotWithin#151
Conversation
5ff07ab to
60517f2
Compare
|
I started adding tests for For example: @Override
public void of(Pose2d expected) {
translation().isNotWithin(tolerance).of(expected.getTranslation());
rotation().isNotWithin(tolerance).of(expected.getRotation());
}If both the rotation and the translation are not within tolerance than this will not throw, but if only one of them is not within tolerance it will throw. |
db80c86 to
787d19c
Compare
|
@cuttestkittensrule I removed the broken Currently all of the tests use expected and actual values that have the same units. We should add tests for different units (ex: volts vs minivolts). |
…0 in the tolerence Should just use the helper method once #156 gets merged into main fully
|
@kcooney Thanks for adding tests! I removed some uneccesary absolute value calculations, and added another edge case to the tolerance check. I'll mege in a bit (assuming the tests pass) (though I might add more tests first) |
|
Looks like there was a bug in both |
Originally, the tolerance was just converted to the base unit, and that is used as the tolerance. This is usually accurate, but it isn't for units that have an offset, like temperature. So, the tolerance is now the given tolerance (in the base unit) minus 0 units of the tolerance's unit in the base unit. This makes it work as expected for units with an offset (like Fahrenheit and Celsius).
7d2e6cb to
1679846
Compare
…gative 0 in the tolerence
…gative 0 in the tolerence
Now there are tests for both units with offsets, and those without offsets
This will make it easier to copy new Javadoc to the website for future releases.
**New Builder Methods**
- Add `withPoseFilter()`
- Poses that are not within the field are filtered out
- Add `withMultiTagFallbackStrategy()`
**Logging Support**
- Add an overload for `processAllUnreadResults()` that allows the caller
to be notified of rejected poses
- Use `instanceof` pattern matching - Make classes static that can be static - Fix Javadoc errors
b181988 to
1c5dde3
Compare
Measureclass, and can check if a value is what is expected, within a given degree of tolerance. This degree of tolerance is supplied as aMeasureso it is clear what unit it is in.isNotWithinDoubleSubject'sisNotWithinto assert that a value is not within a given tolerance of an expected value.