summaryrefslogtreecommitdiff
path: root/tests/test-vprintf-posix.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-03-09 03:43:46 +0000
committerBruno Haible <bruno@clisp.org>2007-03-09 03:43:46 +0000
commited91d0417a5d9abb08f7e3de0a5656e8974dbc76 (patch)
tree54a3d3f0fc11aea371b21b16b9515a1ef021650d /tests/test-vprintf-posix.c
parent253d24cffae8936bcce6f53046b71ec0a5427227 (diff)
downloadgnulib-ed91d0417a5d9abb08f7e3de0a5656e8974dbc76.tar.gz
Tests for module 'vprintf-posix'.
Diffstat (limited to 'tests/test-vprintf-posix.c')
-rw-r--r--tests/test-vprintf-posix.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/test-vprintf-posix.c b/tests/test-vprintf-posix.c
new file mode 100644
index 0000000000..6f7f141d10
--- /dev/null
+++ b/tests/test-vprintf-posix.c
@@ -0,0 +1,53 @@
+/* Test of POSIX compatible vfprintf() function.
+ Copyright (C) 2007 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define ASSERT(expr) if (!(expr)) abort ();
+
+static int
+my_printf (const char *format, ...)
+{
+ va_list args;
+ int ret;
+
+ va_start (args, format);
+ ret = vprintf (format, args);
+ va_end (args);
+ return ret;
+}
+
+#include "test-printf-posix.h"
+
+int
+main (int argc, char *argv[])
+{
+ test_function (my_printf);
+ return 0;
+}