tests/libpspp/tower-test \
tests/libpspp/u8-istream-test \
tests/libpspp/zip-test \
- tests/output/render-test
+ tests/output/render-test \
+ tests/ui/syntax-gen-test
+
check-programs: $(check_PROGRAMS)
src/libpspp-core.la \
$(CAIRO_LIBS)
+
+check_PROGRAMS += tests/ui/syntax-gen-test
+tests_ui_syntax_gen_test_SOURCES = tests/ui/syntax-gen-test.c
+tests_ui_syntax_gen_test_LDADD = \
+ src/ui/libuicommon.la \
+ src/libpspp-core.la \
+ $(CAIRO_LIBS)
+
+
EXTRA_DIST += \
tests/coverage.sh \
tests/data/bcd-in.expected.cmp.gz \
tests/output/paper-size.at \
tests/output/render.at \
tests/ui/terminal/main.at \
+ tests/ui/syntax-gen.at \
tests/perl-module.at
TESTSUITE = $(srcdir)/tests/testsuite
--- /dev/null
+#include <config.h>
+
+#include "ui/syntax-gen.h"
+
+#include <stdio.h>
+
+static void
+test_runner (const char *format, ...)
+{
+ struct string syntax;
+ va_list args;
+ va_start (args, format);
+
+ ds_init_empty (&syntax);
+
+ syntax_gen_pspp_valist (&syntax, format, args);
+
+ va_end (args);
+
+ puts (ds_cstr (&syntax));
+
+ ds_destroy (&syntax);
+}
+
+int
+main (void)
+{
+ test_runner ("A simple string: %ssEND", "Hello world");
+ test_runner ("A syntax string: %sqEND", "Hello world");
+ test_runner ("A syntax string containing \": %sqEND", "here\"is the quote");
+ test_runner ("A syntax string containing non-printables: %sqEND", "A CtrlL\fchar");
+ test_runner ("An integer: %dEND", 98765);
+ test_runner ("A floating point number: %gEND", 3.142);
+ test_runner ("A floating point number with default precision: %fEND", 1.234);
+ test_runner ("A literal %%");
+
+ test_runner ("and %ss a %sq of %d different %f examples %g of 100%% conversions.",
+ "finally", "concatination", 6, 20.309, 23.09);
+
+ return 0;
+}
--- /dev/null
+AT_BANNER([SYNTAX GENERATOR])
+
+AT_SETUP([Syntax Generation - printf like])
+
+AT_CHECK([$abs_top_builddir/tests/ui/syntax-gen-test],[0],[dnl
+A simple string: Hello worldEND
+A syntax string: "Hello world"END
+A syntax string containing ": 'here"is the quote'END
+A syntax string containing non-printables: X'41204374726C4C0C63686172'END
+An integer: 98765END
+A floating point number: 3.142END
+A floating point number with default precision: 1.234000END
+A literal %
+and finally a "concatination" of 6 different 20.309000 examples 23.09 of 100% conversions.
+])
+
+AT_CLEANUP