From 1179ff0ccef3782fca39e1b4b85968ce9cebfe47 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sat, 16 Jul 2022 16:22:09 +0200 Subject: [PATCH] test/embedded: add test for btstack_strcat --- test/embedded/btstack_util_test.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/embedded/btstack_util_test.cpp b/test/embedded/btstack_util_test.cpp index 7c43e5faa..e28639a4e 100644 --- a/test/embedded/btstack_util_test.cpp +++ b/test/embedded/btstack_util_test.cpp @@ -283,6 +283,17 @@ TEST(BTstackUtil, crc8){ CHECK_EQUAL(1, btstack_crc8_check(data, sizeof(data), 74)); } +TEST(BTstackUtil, strcat){ + char summaries[3][7 * 8 + 1]; + CHECK_EQUAL((7*8+1), sizeof(summaries[0])); + summaries[0][0] = 0; + char item_text[10]; + sprintf(item_text, "%04x:%02d ", 1 ,2); + btstack_strcat(summaries[0], sizeof(summaries[0]), item_text); + sprintf(item_text, "%04x:%02d ", 3 ,4); + btstack_strcat(summaries[0], sizeof(summaries[0]), item_text); + STRCMP_EQUAL("0001:02 0003:04 ", summaries[0]); +} int main (int argc, const char * argv[]){ return CommandLineTestRunner::RunAllTests(argc, argv);