diff options
Diffstat (limited to 'firmware/test/snprintf/test.c')
-rw-r--r-- | firmware/test/snprintf/test.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/firmware/test/snprintf/test.c b/firmware/test/snprintf/test.c new file mode 100644 index 0000000000..8923c9c9f5 --- /dev/null +++ b/firmware/test/snprintf/test.c | |||
@@ -0,0 +1,17 @@ | |||
1 | |||
2 | #include <stdio.h> | ||
3 | |||
4 | #include "sprintf.h" | ||
5 | |||
6 | int main(int argc, char **argv) | ||
7 | { | ||
8 | char buffer[256]; | ||
9 | snprintf(buffer, 5, "123456789"); | ||
10 | printf("%s\n", buffer); | ||
11 | snprintf(buffer, 6, "123456789"); | ||
12 | printf("%s\n", buffer); | ||
13 | snprintf(buffer, 7, "123456789"); | ||
14 | printf("%s\n", buffer); | ||
15 | snprintf(buffer, 7, "123%s", "mooooooooooo"); | ||
16 | printf("%s\n", buffer); | ||
17 | } | ||