aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-06-24 02:56:55 -0400
committerMike Frysinger <vapier@gentoo.org>2012-07-02 19:41:57 -0400
commitb20192faa0aa305afaa54d4b6e79391692f9a403 (patch)
tree0aab15832a9b37850651d6f1197556162edc0b11 /tests
parenttests: enable color/parallel by default (diff)
downloadsandbox-b20192faa0aa305afaa54d4b6e79391692f9a403.tar.gz
sandbox-b20192faa0aa305afaa54d4b6e79391692f9a403.tar.bz2
sandbox-b20192faa0aa305afaa54d4b6e79391692f9a403.zip
sb_printf: expand feature set slightly and fix testing
This adds support for signed ll, unsigned z, l, and ll, hex l, and ll, ignores the # for hex output since this is what we do implicitly already. As for testing, looks like during the autogeneration of testsuite.list.at, the sb_printf test was lost. Restore it so it gets run again. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/sb_printf.at2
-rw-r--r--tests/sb_printf_tst.c14
3 files changed, 16 insertions, 2 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6a05fe3..a923ddc 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -109,5 +109,5 @@ $(TESTSUITE): $(AT_FILES) testsuite.list.at
testsuite.list.at: $(AT_FILES)
( echo "dnl DO NOT EDIT: GENERATED BY MAKEFILE.AM"; \
- $(GREP) -l '^SB_CHECK' $(AT_FILES) | LC_ALL=C sort | \
+ $(GREP) -l -e '^SB_CHECK' -e '^AT_CHECK' $(AT_FILES) | LC_ALL=C sort | \
$(SED) -e 's:^[.]/:sb_inc([:' -e 's:[.]at$$:]):' ) > $@
diff --git a/tests/sb_printf.at b/tests/sb_printf.at
index b632b96..4a2b628 100644
--- a/tests/sb_printf.at
+++ b/tests/sb_printf.at
@@ -16,7 +16,7 @@ sb_printf_tst | ${AWK} 'BEGIN { ret = 0 }
# not so easy -- we format sandbox printf() the way we like
# %x -- we prefix output with 0x
- if ($1 ~ /%[[xX]]/)
+ if ($1 ~ /%[[luz#]]*[[xX]]/)
gsub(/\<0x/, "")
# %p -- we zero pad the output
diff --git a/tests/sb_printf_tst.c b/tests/sb_printf_tst.c
index 1db7c33..867f782 100644
--- a/tests/sb_printf_tst.c
+++ b/tests/sb_printf_tst.c
@@ -20,9 +20,15 @@ int main(int argc, char *argv[])
T("%i", argc);
T("%i", -argc);
+ T("%li", (long)argc);
+ T("%li", (long)-argc);
T("%d", 123);
T("%d", -123);
+ T("%lld", (long long)123);
+ T("%lld", (long long)-123);
T("%u", 1000);
+ T("%lu", (unsigned long)1234);
+ T("%llu", (unsigned long long)5679);
T("%zi", (ssize_t)argc);
T("%zi", (ssize_t)-argc);
T("%zd", (ssize_t)123);
@@ -31,6 +37,14 @@ int main(int argc, char *argv[])
T("%x", argc);
T("%x", 0xabcdef);
+ T("%#x", argc);
+ T("%#x", 0xabcdef);
+ T("%lx", (unsigned long)argc);
+ T("%lx", (unsigned long)0xabcdef);
+ T("%llx", (unsigned long long)argc);
+ T("%llx", (unsigned long long)0xabcdef);
+ T("%zx", (size_t)argc);
+ T("%zx", (size_t)0xabcdef);
T("%X", argc);
T("%X", 0xabcdef);