Closed martinjaeger closed 7 months ago
To check floating points, you can use zassert_within, but it's not necessary for this PR.
Yeah, I've seen very funny things with floating point comparisons. I prefer to use zassert_equal
whenever possible, so that you don't have to think about which tolerance you want to allow.
Thanks for the quick review!
The unit tests were still based on UNITY as a test framework for legacy reasons (from a time where the BMS firmware was based on Mbed OS and PlatformIO).
The Zephyr Ztest framework has better built-in support for running with twister and doesn't require any external module. It's also just more common for Zephyr folks.
This PR converts all tests from UNITY to Ztest and restructures the tests from one single large test suite into dedicated suites for helper tools, different BMS ICs and common BMS features. This will make it easier to write unit test for future features like improved SOC calculation.