Merge pull request #8243 from gebart/pr/tests-snprintf
unittests: Fix printf float test BUFSIZE
This commit is contained in:
commit
b151f95b61
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "tests-printf_float.h"
|
#include "tests-printf_float.h"
|
||||||
|
|
||||||
#define BUFSIZE (10)
|
#define BUFSIZE (12)
|
||||||
|
|
||||||
static const double in0 = 2016.0349;
|
static const double in0 = 2016.0349;
|
||||||
static const double in1 = 123.4567;
|
static const double in1 = 123.4567;
|
||||||
@ -37,7 +37,7 @@ static void sfprintf_float(void)
|
|||||||
char *str = tmp;
|
char *str = tmp;
|
||||||
|
|
||||||
snprintf(str, BUFSIZE, "%f", in0);
|
snprintf(str, BUFSIZE, "%f", in0);
|
||||||
TEST_ASSERT_EQUAL_STRING("2016.0349", str);
|
TEST_ASSERT_EQUAL_STRING("2016.034900", str);
|
||||||
|
|
||||||
snprintf(str, BUFSIZE, "%.2f", in0);
|
snprintf(str, BUFSIZE, "%.2f", in0);
|
||||||
TEST_ASSERT_EQUAL_STRING("2016.03", str);
|
TEST_ASSERT_EQUAL_STRING("2016.03", str);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user