SignalK / SensESP

Universal Signal K sensor framework for the ESP32 platform
https://signalk.org/SensESP/
Apache License 2.0
158 stars 82 forks source link

Unit tests and memory safety #765

Closed mairas closed 1 month ago

mairas commented 1 month ago

At long last, I have implemented few rudimentary unit tests for SensESP. Not great, but at least it will be easier to add new ones in the future.

Also at long last, I have taken some steps to improve memory safety on SensESP. The codebase has been quite nonchalant about creating objects on the heap and not properly tracking them. This hasn't been an issue as long as the enclosing objects haven't been destroyed, but it's not a good practice, and with unit testing, it should be expected that the whole SensESP app will be torn down. I have now wrapped many internal heap objects in shared_ptr or unique_ptr and also added some destructors for select classes.