summaryrefslogtreecommitdiff
path: root/tests/test-xstrtoumax.sh
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2007-08-08 12:45:54 +0000
committerEric Blake <ebb9@byu.net>2007-08-08 12:45:54 +0000
commitc7110f3b833159c91e8cbe6a14349174aeef4ab6 (patch)
treeb1f30e57f6dab6db962d6ac823191b940964c6d6 /tests/test-xstrtoumax.sh
parentfe32d83182dd651bbdaee9a8b6a54c6e3ad9ad2e (diff)
downloadgnulib-c7110f3b833159c91e8cbe6a14349174aeef4ab6.tar.gz
Move xstrtol messages into gnulib domain, when --pobase is used.
* lib/xstrtol.h (_STRTOL_ERROR): Move messages out of macro... * lib/xstrtol-error.c (xstrtol_error): ...into new file. * modules/xstrtol (Files): Distribute new file. * m4/xstrtol.m4 (gl_XSTRTOL): Build new file. * lib/xstrtol.c (TESTING_XSTRTO): Move tests... * tests/test-xstrtol.c: ...into new file. * tests/test-xstrtoul.c: Also test xstrtoul. * tests/test-xstrtoimax.c: Also test xstrtoimax. * tests/test-xstrtoumax.c: Also test xstrtoumax. * tests/test-xstrtol.sh: Drive the tests. * tests/test-xstrtoimax.sh: Likewise. * tests/test-xstrtoumax.sh: Likewise. * modules/xstrtol-tests: New module. * modules/xstrtoimax-tests: Likewise. * modules/xstrtoumax-tests: Likewise.
Diffstat (limited to 'tests/test-xstrtoumax.sh')
-rwxr-xr-xtests/test-xstrtoumax.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test-xstrtoumax.sh b/tests/test-xstrtoumax.sh
new file mode 100755
index 0000000000..ab065ba580
--- /dev/null
+++ b/tests/test-xstrtoumax.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+tmpfiles=""
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+tmpfiles="t-xstrtoumax.tmp t-xstrtoumax.xo"
+: > t-xstrtoumax.tmp
+too_big=99999999999999999999999999999999999999999999999999999999999999999999
+result=0
+
+# test xstrtoumax
+./test-xstrtoumax${EXEEXT} 1 >> t-xstrtoumax.tmp 2>&1 || result=1
+./test-xstrtoumax${EXEEXT} -1 >> t-xstrtoumax.tmp 2>&1 && result=1
+./test-xstrtoumax${EXEEXT} 1k >> t-xstrtoumax.tmp 2>&1 || result=1
+./test-xstrtoumax${EXEEXT} ${too_big}h >> t-xstrtoumax.tmp 2>&1 && result=1
+./test-xstrtoumax${EXEEXT} $too_big >> t-xstrtoumax.tmp 2>&1 && result=1
+./test-xstrtoumax${EXEEXT} x >> t-xstrtoumax.tmp 2>&1 && result=1
+./test-xstrtoumax${EXEEXT} 9x >> t-xstrtoumax.tmp 2>&1 && result=1
+./test-xstrtoumax${EXEEXT} 010 >> t-xstrtoumax.tmp 2>&1 || result=1
+./test-xstrtoumax${EXEEXT} MiB >> t-xstrtoumax.tmp 2>&1 || result=1
+
+# normalize output
+sed -e 's/^[^:]*: //' < t-xstrtoumax.tmp > t-xstrtoumax.xo
+mv t-xstrtoumax.xo t-xstrtoumax.tmp
+
+# compare expected output
+cat > t-xstrtoumax.xo <<EOF
+1->1 ()
+invalid arg argument \`-1'
+1k->1024 ()
+invalid suffix in arg argument \`${too_big}h'
+arg argument \`$too_big' too large
+invalid arg argument \`x'
+invalid suffix in arg argument \`9x'
+010->8 ()
+MiB->1048576 ()
+EOF
+
+diff t-xstrtoumax.xo t-xstrtoumax.tmp || result=1
+
+rm -fr $tmpfiles
+
+exit $result