summaryrefslogtreecommitdiff
path: root/tests/test_vsnprintf_static.c
diff options
context:
space:
mode:
authorjvoisin2023-07-11 00:14:13 +0200
committerjvoisin2023-07-11 00:18:32 +0200
commit8b6129312db7b2405f883c4080b835c69a855627 (patch)
tree3fae0f94c33537db91c4c8488e78f467371f12b0 /tests/test_vsnprintf_static.c
parent759cb4697e9bba06a5aabad9899d0700f57051da (diff)
Add more dynamic tests
Diffstat (limited to 'tests/test_vsnprintf_static.c')
-rw-r--r--tests/test_vsnprintf_static.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_vsnprintf_static.c b/tests/test_vsnprintf_static.c
new file mode 100644
index 0000000..f1263a8
--- /dev/null
+++ b/tests/test_vsnprintf_static.c
@@ -0,0 +1,28 @@
1#include "common.h"
2
3#include <stdarg.h>
4#include <unistd.h>
5
6char buffer[12] = {0};
7
8int msg_valid(int n, const char * format, ... ) {
9 va_list args;
10 va_start (args, format);
11 vsnprintf(buffer, n, format, args);
12 va_end (args);
13}
14
15int msg(int n, const char * format, ... ) {
16 va_list args;
17 va_start (args, format);
18 CHK_FAIL_START
19 vsnprintf(buffer, n, format, args);
20 CHK_FAIL_END
21 va_end (args);
22 return ret;
23}
24
25int main(int argc, char** argv) {
26 msg_valid(sizeof(buffer), "%s", "1234567890ABCDEF");
27 return msg(sizeof(buffer)+1, "%s", "1234567890ABCDEF");
28}