From 19d3995504efc67dc32b6c37bb3b189097c9a7b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= Date: Tue, 6 Feb 2018 08:13:00 +0100 Subject: [PATCH] unittests/fmt: Add max test for fmt_u16_dec --- tests/unittests/tests-fmt/tests-fmt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/unittests/tests-fmt/tests-fmt.c b/tests/unittests/tests-fmt/tests-fmt.c index 6537b19d41..3e3d1765b7 100644 --- a/tests/unittests/tests-fmt/tests-fmt.c +++ b/tests/unittests/tests-fmt/tests-fmt.c @@ -194,7 +194,7 @@ static void test_fmt_u32_dec(void) static void test_fmt_u16_dec(void) { - char out[5] = "----"; + char out[8] = "zzzzzzz"; uint16_t val = 6556; uint8_t chars = 0; @@ -202,6 +202,12 @@ static void test_fmt_u16_dec(void) TEST_ASSERT_EQUAL_INT(4, chars); out[chars] = '\0'; TEST_ASSERT_EQUAL_STRING("6556", (char *) out); + + val = 65535; + chars = fmt_u16_dec(out, val); + TEST_ASSERT_EQUAL_INT(5, chars); + out[chars] = '\0'; + TEST_ASSERT_EQUAL_STRING("65535", (char *) out); } static void test_fmt_s32_dec_a(void)