summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-03-16 19:12:48 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-03-16 19:12:48 +0000
commit2955a2ead367c14169a74cfc2557d0ceb2bd334f (patch)
tree452ea5a76043e6505f49cd2ec301efdac3508243 /firmware
parente5e9bc3e65d34de202b41ca51d8bff117e240830 (diff)
downloadrockbox-2955a2ead367c14169a74cfc2557d0ceb2bd334f.tar.gz
rockbox-2955a2ead367c14169a74cfc2557d0ceb2bd334f.zip
initial test code for the snprintf() (and family) function
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3449 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/test/snprintf/Makefile16
-rw-r--r--firmware/test/snprintf/test.c17
2 files changed, 33 insertions, 0 deletions
diff --git a/firmware/test/snprintf/Makefile b/firmware/test/snprintf/Makefile
new file mode 100644
index 0000000000..39f128ed8a
--- /dev/null
+++ b/firmware/test/snprintf/Makefile
@@ -0,0 +1,16 @@
+
+TARGET = snprintf
+
+OBJS = snprintf.o test.o
+
+CFLAGS = -I../../include
+
+$(TARGET): $(OBJS)
+
+snprintf.o: ../../common/sprintf.c
+ $(CC) -c $< -o $@
+
+test.o: test.c
+
+clean:
+ rm -f $(OBJS) \ No newline at end of file
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 @@
+
+#include <stdio.h>
+
+#include "sprintf.h"
+
+int main(int argc, char **argv)
+{
+ char buffer[256];
+ snprintf(buffer, 5, "123456789");
+ printf("%s\n", buffer);
+ snprintf(buffer, 6, "123456789");
+ printf("%s\n", buffer);
+ snprintf(buffer, 7, "123456789");
+ printf("%s\n", buffer);
+ snprintf(buffer, 7, "123%s", "mooooooooooo");
+ printf("%s\n", buffer);
+}