Commit Graph
4 Commits
Author SHA1 Message Date
Thomas WatsonandPeter Barker 529bf321be AP_HAL: add test for snprintf and thus ftoa_engine behavior
Ensures subnormals aren't formatted grossly wrong nor cause hangs.

Reveals two additional bugs:

* The requested number of digits is not always produced.

* The precision isn't enough to distinguish every float.

Outputs from the (nominally) original assembly implementation running on
a real AVR (avr-gcc 7.3.0) are included. That implementation exhibits
none of these flaws so it's likely they have been introduced during the
C port.

Co-authored-by: Peter Barker <pbarker@barker.dropbear.id.au>
2025-07-29 16:35:03 +09:00
Peter Barker 3f9a4ee5f9 AP_HAL: fix unit test compilation due to -Werror=format-truncation 2019-11-06 21:42:18 +11:00
Peter Barker 5dad0e5410 AP_HAL: a few more simple tests for snprintf 2019-09-12 16:08:59 +10:00
Peter Barker 412bf24b9a AP_HAL: add gtests for snprintf 2019-09-12 07:42:40 +10:00