From fe3e4269959ea7534722aa2664a3cac69d9109cf Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 31 Oct 2025 15:18:10 +0100 Subject: Add a testsuite Co-Authored-By: q66 --- tests/test_vsnprintf_static.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 tests/test_vsnprintf_static.c (limited to 'tests/test_vsnprintf_static.c') diff --git a/tests/test_vsnprintf_static.c b/tests/test_vsnprintf_static.c new file mode 100644 index 0000000..d6b7e9b --- /dev/null +++ b/tests/test_vsnprintf_static.c @@ -0,0 +1,29 @@ +#include "common.h" + +#include +#include + +char buffer[12] = {0}; + +int msg_valid(int n, const char * format, ... ) { + va_list args; + va_start (args, format); + vsnprintf(buffer, n, format, args); + va_end (args); + return 0; +} + +int msg(int n, const char * format, ... ) { + va_list args; + va_start (args, format); + CHK_FAIL_START + vsnprintf(buffer, n, format, args); + CHK_FAIL_END + va_end (args); + return ret; +} + +int main(int argc, char** argv) { + msg_valid(sizeof(buffer), "%s", "1234567890ABCDEF"); + return msg(sizeof(buffer)+1, "%s", "1234567890ABCDEF"); +} -- cgit v1.3