+*.a
*.gobstamp
*.la
*.lo
/Makefile
/Makefile.in
/aclocal.m4
+/atconfig
+/atlocal
/autom4te.cache
/compile
/config.*
/ltmain.sh
/missing
/mkinstalldirs
+/package.m4
/snippet
/stamp-h1
/test-driver
/test-suite.log
+/testsuite
+/testsuite.deps
+/testsuite.dir
+/testsuite.log
/upkg
# This is free software: you are free to do what the fuck you want to.
# There is NO WARRANTY, to the extent permitted by law.
-AUTOMAKE_OPTIONS = parallel-tests color-tests
ACLOCAL_AMFLAGS = -I m4 -I common/m4
MAINTAINERCLEANFILES =
MOSTLYCLEANFILES =
$(upkg_OBJECTS): $(gnulib_headers) src/upkgopts.h
libupkg_la_SOURCES = src/libupkg.c common/src/pack.c common/src/pack.h
+$(libupkg_la_OBJECTS): $(gnulib_headers)
uobjectdir = $(includedir)/uobject
uobject_HEADERS = src/uobject/uobject.h src/uobject/exportable.h \
engine_la_LIBADD += $(LIBMODPLUG_LIBS)
endif
-check_LTLIBRARIES = libtest.la
check_PROGRAMS = test/decodeindex test/pcxrle
+check_LIBRARIES = libtest.a
-libtest_la_SOURCES = test/common.c test/common.h
+libtest_a_SOURCES = test/common.c test/common.h
+$(libtest_a_OBJECTS): $(gnulib_headers)
-test_decodeindex_LDADD = libupkg.la libgnu.la libtest.la
+TEST_LIBS = libtest.a libgnu.la
+
+test_decodeindex_LDADD = libupkg.la $(TEST_LIBS)
$(test_decodeindex_OBJECTS): $(gnulib_headers)
-test_pcxrle_LDADD = src/engine/pcx.lo libupkg.la libgnu.la libtest.la
+test_pcxrle_LDADD = src/engine/pcx.lo libupkg.la $(TEST_LIBS)
$(test_pcxrle_OBJECTS): $(gnulib_headers)
-TESTS_ENVIRONMENT = SHELL='$(SHELL)' EXEEXT='$(EXEEXT)'
-TEST_EXTENSIONS = .sh
-SH_LOG_COMPILER = $(SHELL)
-
-TESTS = tests/libupkg-index-decode.sh tests/engine-pcx-rlencode.sh
-EXTRA_DIST += $(TESTS)
-
# Supporting rules for GObject Builder
GOB_V = $(GOB_V_@AM_V@)
GOB_V_ = $(GOB_V_@AM_DEFAULT_V@)
include $(top_srcdir)/lib/gnulib.mk
include $(top_srcdir)/libltdl/ltdl.mk
+include $(top_srcdir)/common/snippet/autotest.mk
])
AM_CONDITIONAL([HAVE_GOB2_DYN], [test x"$dx_cv_gob2_dynamic_types" = x"yes"])
+AC_CONFIG_TESTDIR([.], [test:.])
+DX_PROG_AUTOTEST
+AM_CONDITIONAL([HAVE_AUTOTEST], [test x"$dx_cv_autotest_works" = x"yes"])
+
AC_CONFIG_FILES([Makefile libuobject.pc])
AC_OUTPUT
fprintf(f, "%*s", indent, "");
if (n == 0) {
- printf("(empty)\n");
+ fprintf(f, "(empty)\n");
return;
}
+++ /dev/null
-#!/bin/sh
-#
-# Check corner cases of the PCX run-length encoder.
-# Copyright © 2012 Nick Bowler
-#
-# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-# This is free software: you are free to do what the fuck you want to.
-# There is NO WARRANTY, to the extent permitted by law.
-
-pcxrle=test/pcxrle$EXEEXT
-
-$pcxrle 00 || exit 1
-$pcxrle 0000 || exit 1
-$pcxrle c100 || exit 1
-
-# Test RLE rollover
-t1=00
-t2=$t1$t1
-t4=$t2$t2
-t8=$t4$t4
-t16=$t8$t8
-t32=$t16$t16
-t64=$t32$t32
-
-$pcxrle "$t32$t16$t8$t4$t2$t1" || exit 1 # maximum possible run
-$pcxrle "$t64" || exit 1
-$pcxrle "$t64$t64$t64" || exit 1
--- /dev/null
+# Copyright © 2012, 2022 Nick Bowler
+#
+# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
+
+AT_SETUP([upkg_decode_index])
+AT_KEYWORDS([core function])
+
+# various encodings of zero
+m4_foreach_w([INDEX], [00 4000 408000 40808000 4080808000],
+ [AT_CHECK([decodeindex INDEX], [0], [0
+])
+])
+
+# truncated encodings of zero
+m4_foreach_w([INDEX], ['' 40 4080 408080 40808080],
+ [AT_CHECK([decodeindex INDEX], [1], [ignore], [ignore])
+])
+
+# overlong encoding of zero
+AT_CHECK([decodeindex 408080808000], [1], [ignore], [ignore])
+
+AT_CLEANUP
+
+AT_SETUP([pcx_write_scanline run-length encoding])
+AT_KEYWORDS([engine function])
+
+AT_CHECK([pcxrle 00], [0], [00
+])
+AT_CHECK([pcxrle 0000], [0], [c200
+])
+AT_CHECK([pcxrle c100], [0], [c1c100
+])
+
+zero1=00
+zero4=$zero1$zero1$zero1$zero1
+zero16=$zero4$zero4$zero4$zero4
+zero63=$zero16$zero16$zero16$zero4$zero4$zero4$zero1$zero1$zero1
+zero64=$zero16$zero16$zero16$zero16
+zero192=$zero64$zero64$zero64
+
+AT_CHECK([# maximum possible run
+pcxrle $zero63], [0], [ff00
+])
+AT_CHECK([# one more than maximum
+pcxrle $zero64], [0], [ff0000
+])
+AT_CHECK([# consecutive runs
+pcxrle $zero192], [0], [ff00ff00ff00c300
+])
+
+AT_CLEANUP
+++ /dev/null
-#!/bin/sh
-#
-# Check various corner cases of upkg_decode_index.
-# Copyright © 2012, 2022 Nick Bowler
-#
-# License WTFPL2: Do What The Fuck You Want To Public License, version 2.
-# This is free software: you are free to do what the fuck you want to.
-# There is NO WARRANTY, to the extent permitted by law.
-
-decodeindex=test/decodeindex$EXEEXT
-scriptname=$0
-
-test_index() {
- decode_cmd=`exec 3>&1
- { $decodeindex "$1" 3>&-
- echo decode_status=$? >&3
- } | { read val 3>&-
- echo decode_val=\'$val\' >&3;
- }`
- eval "$decode_cmd"
-
- case $# in
- 2)
- (exit $decode_status) || return 1
- if test x"$decode_val" != x"$2"; then
- printf '%s: result (%d) does not match expected (%d)\n' \
- "$scriptname" "$decode_val" "$2"
- return 1
- fi
- ;;
- 1)
- if (exit $decode_status); then
- printf '%s: false positive on (%s), got (%d)\n' \
- "$scriptname" "$1" "$decode_val"
- return 1
- fi
- ;;
- esac
-}
-
-test_index 00 0 || exit 1
-test_index 4000 0 || exit 1
-test_index 408000 0 || exit 1
-test_index 40808000 0 || exit 1
-test_index 4080808000 0 || exit 1
-
-# False positives
-test_index '' || exit 1
-test_index 40 || exit 1
-test_index 4080 || exit 1
-test_index 408080 || exit 1
-test_index 40808080 || exit 1
-test_index 4080808080 || exit 1
-test_index 408080808000 || exit 1
--- /dev/null
+AT_COPYRIGHT([Copyright © 2022 Nick Bowler])
+#
+# 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 3 of the License, 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, see <https://www.gnu.org/licenses/>.
+
+AT_INIT
+AT_COLOR_TESTS
+
+AT_TESTED([upkg])
+
+m4_include([tests/functions.at])