summaryrefslogtreecommitdiff
path: root/dviware/dvi2bitmap/test
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /dviware/dvi2bitmap/test
Initial commit
Diffstat (limited to 'dviware/dvi2bitmap/test')
-rw-r--r--dviware/dvi2bitmap/test/Makefile.am118
-rw-r--r--dviware/dvi2bitmap/test/Makefile.in1148
-rw-r--r--dviware/dvi2bitmap/test/modetest-maths.tex20
-rw-r--r--dviware/dvi2bitmap/test/modetest.tex112
-rw-r--r--dviware/dvi2bitmap/test/t1.cc127
-rw-r--r--dviware/dvi2bitmap/test/t2.cc100
-rw-r--r--dviware/dvi2bitmap/test/t3.cc173
-rw-r--r--dviware/dvi2bitmap/test/t4.cc94
-rw-r--r--dviware/dvi2bitmap/test/t5.cc321
-rw-r--r--dviware/dvi2bitmap/test/t5.dvibin0 -> 236 bytes
-rw-r--r--dviware/dvi2bitmap/test/t6.cc714
-rw-r--r--dviware/dvi2bitmap/test/t7.cc218
-rwxr-xr-xdviware/dvi2bitmap/test/t8.pl195
-rwxr-xr-xdviware/dvi2bitmap/test/t8.pl.in195
14 files changed, 3535 insertions, 0 deletions
diff --git a/dviware/dvi2bitmap/test/Makefile.am b/dviware/dvi2bitmap/test/Makefile.am
new file mode 100644
index 0000000000..df62282c2a
--- /dev/null
+++ b/dviware/dvi2bitmap/test/Makefile.am
@@ -0,0 +1,118 @@
+## Process this file with automake to produce Makefile.in
+
+# Makefile for the test directory
+#
+# - The test of hello.dvi is the basic test of dvi2bitmap
+# - modetest.tex is more of a test of the Metafont modes than one of
+# dvi2bitmap, but it does exercise a range of fonts, and so can show
+# some weaknesses.
+
+TESTS = t1.test t2.test t3.test t4.test t5.test t6.test t7.test t8.test
+
+CHECK_programs = $(TESTS)
+
+EXTRA_DIST = t5.dvi modetest.tex modetest-maths.tex
+
+# All the tests depend on the library
+$(TESTS): ../libdvi2bitmap.la
+
+SUFFIXES = .dvi .dtl
+
+# The dvi2bitmap program we'll use. This is usually the one just built in
+# the parent, but allow this to be overridden.
+DVI2BITMAP = ../dvi2bitmap
+
+.dtl.dvi:
+ dt2dv $< $@ >$@.log 2>&1
+
+check_PROGRAMS = $(TESTS)
+
+t5_test_LDFLAGS = -lm
+t7_test_LDFLAGS = -lm
+LDADD = ../libdvi2bitmap.la
+AM_CPPFLAGS = -I..
+t1_test_SOURCES = t1.cc
+t2_test_SOURCES = t2.cc
+t3_test_SOURCES = t3.cc
+t4_test_SOURCES = t4.cc
+t5_test_SOURCES = t5.cc
+t6_test_SOURCES = t6.cc
+t7_test_SOURCES = t7.cc
+t8_test_SOURCES = t8.pl
+# t8.test is a perl script -- see below
+
+# t8.test is just a link to t8.pl.
+t8.test$(EXEEXT): t8.pl
+ if test -w t8.test; then rm -f t8.test;fi
+ $(LN_S) t8.pl t8.test$(EXEEXT)
+
+# Test 5 depends on its DVI file; test 7 uses it, too
+t5.test$(EXEEXT) t7.test$(EXEEXT): t5.dvi
+
+# t6.test forks and execs itself, so the libtool trick of creating a shell
+# script with the same name, which resolves the shared library dependencies,
+# won't work. Instead link it statically. Note that this fails on Tru64
+# because of some as-yet unintelligible linking problem [FIXME: why doesn't
+# it work on Tru64 -- I can't see the problem in the ld messages]
+# We should, I suppose, use t6_test_LDFLAGS=-all-static here, but that doesn't
+# seem to work on OSX, though the libtool manual says that this is what it's
+# for. Give up, and just do the link by hand [XXX rather bogus, this might
+# possibly fail on other platforms].
+t6.test$(EXEEXT): t6.o
+ $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o t6.test$(EXEEXT) t6.o ../.libs/libdvi2bitmap.a
+
+pathtest: hello.dvi
+ sh ./test-font-gen.sh $(DVI2BITMAP) hello.dvi temp-hello-output
+
+#magtest: magtest.dvi
+# sh ./test-font-gen.sh $(DVI2BITMAP) magtest.dvi temp-magtest-output
+
+modetest: modetest.dvi
+ sh ./test-font-gen.sh $(DVI2BITMAP) modetest.dvi temp-modetest-output
+
+hello.dvi: hello.tex
+ tex hello
+
+testcase-magnification.dvi: testcase-magnification.tex
+ tex testcase-magnification
+
+modetest.dvi: modetest.tex
+ latex modetest
+
+modetest-maths.dvi: modetest-maths.tex
+ latex modetest-maths
+
+modetest-maths-concmath.dvi: modetest-maths-concmath.tex
+ latex '\def\optionswitch{1}\input modetest-maths-concmath.tex '
+
+modetest-maths-concmath.tex: modetest-maths.tex
+ ln -s modetest-maths.tex modetest-maths-concmath.tex
+
+# The sampler relies on scsh to be installed
+%-sampler.html: %.dvi
+ ./make-sampler.scsh -x$(DVI2BITMAP) -o$(@:.html=) -d$< -t$(<:.dvi=.tex)
+
+sampler.tar: sampler.html \
+ modetest-sampler.html \
+ modetest-maths-sampler.html \
+ modetest-maths-concmath-sampler.html \
+ modetest-maths-concmath.tex
+ rm -Rf sampler
+ mkdir sampler
+ cp modetest-sampler.html modetest-maths-sampler.html modetest-maths-concmath-sampler.html sampler
+ cp modetest*.png sampler
+ cp modetest.tex modetest-maths.tex modetest-maths-concmath.tex sampler
+ cp sampler.html sampler
+ tar cf $@ sampler
+ rm -Rf sampler
+
+MOSTLYCLEANFILES = \
+ t6.data \
+ *~ *.o *.lo *.test *.stderr \
+ *.log *.aux *.dvi *.pdf \
+ test-output* temp* \
+ modetest*sampler* \
+ modetest-maths-concmath.tex
+
+CLEANFILES = sampler.tar
diff --git a/dviware/dvi2bitmap/test/Makefile.in b/dviware/dvi2bitmap/test/Makefile.in
new file mode 100644
index 0000000000..cc8467f6fc
--- /dev/null
+++ b/dviware/dvi2bitmap/test/Makefile.in
@@ -0,0 +1,1148 @@
+# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Makefile for the test directory
+#
+# - The test of hello.dvi is the basic test of dvi2bitmap
+# - modetest.tex is more of a test of the Metafont modes than one of
+# dvi2bitmap, but it does exercise a range of fonts, and so can show
+# some weaknesses.
+VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+TESTS = t1.test$(EXEEXT) t2.test$(EXEEXT) t3.test$(EXEEXT) \
+ t4.test$(EXEEXT) t5.test$(EXEEXT) t6.test$(EXEEXT) \
+ t7.test$(EXEEXT) t8.test$(EXEEXT)
+check_PROGRAMS = $(am__EXEEXT_1)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(srcdir)/t8.pl.in $(top_srcdir)/depcomp \
+ $(top_srcdir)/test-driver
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = t8.pl
+CONFIG_CLEAN_VPATH_FILES =
+am__EXEEXT_1 = t1.test$(EXEEXT) t2.test$(EXEEXT) t3.test$(EXEEXT) \
+ t4.test$(EXEEXT) t5.test$(EXEEXT) t6.test$(EXEEXT) \
+ t7.test$(EXEEXT) t8.test$(EXEEXT)
+am_t1_test_OBJECTS = t1.$(OBJEXT)
+t1_test_OBJECTS = $(am_t1_test_OBJECTS)
+t1_test_LDADD = $(LDADD)
+t1_test_DEPENDENCIES = ../libdvi2bitmap.la
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 =
+am_t2_test_OBJECTS = t2.$(OBJEXT)
+t2_test_OBJECTS = $(am_t2_test_OBJECTS)
+t2_test_LDADD = $(LDADD)
+t2_test_DEPENDENCIES = ../libdvi2bitmap.la
+am_t3_test_OBJECTS = t3.$(OBJEXT)
+t3_test_OBJECTS = $(am_t3_test_OBJECTS)
+t3_test_LDADD = $(LDADD)
+t3_test_DEPENDENCIES = ../libdvi2bitmap.la
+am_t4_test_OBJECTS = t4.$(OBJEXT)
+t4_test_OBJECTS = $(am_t4_test_OBJECTS)
+t4_test_LDADD = $(LDADD)
+t4_test_DEPENDENCIES = ../libdvi2bitmap.la
+am_t5_test_OBJECTS = t5.$(OBJEXT)
+t5_test_OBJECTS = $(am_t5_test_OBJECTS)
+t5_test_LDADD = $(LDADD)
+t5_test_DEPENDENCIES = ../libdvi2bitmap.la
+t5_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(t5_test_LDFLAGS) $(LDFLAGS) -o $@
+am_t6_test_OBJECTS = t6.$(OBJEXT)
+t6_test_OBJECTS = $(am_t6_test_OBJECTS)
+t6_test_LDADD = $(LDADD)
+t6_test_DEPENDENCIES = ../libdvi2bitmap.la
+am_t7_test_OBJECTS = t7.$(OBJEXT)
+t7_test_OBJECTS = $(am_t7_test_OBJECTS)
+t7_test_LDADD = $(LDADD)
+t7_test_DEPENDENCIES = ../libdvi2bitmap.la
+t7_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(t7_test_LDFLAGS) $(LDFLAGS) -o $@
+am_t8_test_OBJECTS =
+t8_test_OBJECTS = $(am_t8_test_OBJECTS)
+t8_test_LDADD = $(LDADD)
+t8_test_DEPENDENCIES = ../libdvi2bitmap.la
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+AM_V_CXX = $(am__v_CXX_@AM_V@)
+am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
+am__v_CXX_0 = @echo " CXX " $@;
+am__v_CXX_1 =
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
+am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
+am__v_CXXLD_0 = @echo " CXXLD " $@;
+am__v_CXXLD_1 =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
+CCLD = $(CC)
+LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
+SOURCES = $(t1_test_SOURCES) $(t2_test_SOURCES) $(t3_test_SOURCES) \
+ $(t4_test_SOURCES) $(t5_test_SOURCES) $(t6_test_SOURCES) \
+ $(t7_test_SOURCES) $(t8_test_SOURCES)
+DIST_SOURCES = $(t1_test_SOURCES) $(t2_test_SOURCES) \
+ $(t3_test_SOURCES) $(t4_test_SOURCES) $(t5_test_SOURCES) \
+ $(t6_test_SOURCES) $(t7_test_SOURCES) $(t8_test_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
+ETAGS = etags
+CTAGS = ctags
+am__tty_colors_dummy = \
+ mgn= red= grn= lgn= blu= brg= std=; \
+ am__color_tests=no
+am__tty_colors = { \
+ $(am__tty_colors_dummy); \
+ if test "X$(AM_COLOR_TESTS)" = Xno; then \
+ am__color_tests=no; \
+ elif test "X$(AM_COLOR_TESTS)" = Xalways; then \
+ am__color_tests=yes; \
+ elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \
+ am__color_tests=yes; \
+ fi; \
+ if test $$am__color_tests = yes; then \
+ red=''; \
+ grn=''; \
+ lgn=''; \
+ blu=''; \
+ mgn=''; \
+ brg=''; \
+ std=''; \
+ fi; \
+}
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__recheck_rx = ^[ ]*:recheck:[ ]*
+am__global_test_result_rx = ^[ ]*:global-test-result:[ ]*
+am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]*
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+ recheck = 1; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ { \
+ if ((getline line2 < ($$0 ".log")) < 0) \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+ { \
+ recheck = 0; \
+ break; \
+ } \
+ else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+ { \
+ break; \
+ } \
+ }; \
+ if (recheck) \
+ print $$0; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+ print "fatal: making $@: " msg | "cat >&2"; \
+ exit 1; \
+} \
+function rst_section(header) \
+{ \
+ print header; \
+ len = length(header); \
+ for (i = 1; i <= len; i = i + 1) \
+ printf "="; \
+ printf "\n\n"; \
+} \
+{ \
+ copy_in_global_log = 1; \
+ global_test_result = "RUN"; \
+ while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".trs"); \
+ if (line ~ /$(am__global_test_result_rx)/) \
+ { \
+ sub("$(am__global_test_result_rx)", "", line); \
+ sub("[ ]*$$", "", line); \
+ global_test_result = line; \
+ } \
+ else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+ copy_in_global_log = 0; \
+ }; \
+ if (copy_in_global_log) \
+ { \
+ rst_section(global_test_result ": " $$0); \
+ while ((rc = (getline line < ($$0 ".log"))) != 0) \
+ { \
+ if (rc < 0) \
+ fatal("failed to read from " $$0 ".log"); \
+ print line; \
+ }; \
+ printf "\n"; \
+ }; \
+ close ($$0 ".trs"); \
+ close ($$0 ".log"); \
+}'
+# Restructured Text title.
+am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
+# Solaris 10 'make', and several other traditional 'make' implementations,
+# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it
+# by disabling -e (using the XSI extension "set +e") if it's set.
+am__sh_e_setup = case $$- in *e*) set +e;; esac
+# Default flags passed to test drivers.
+am__common_driver_flags = \
+ --color-tests "$$am__color_tests" \
+ --enable-hard-errors "$$am__enable_hard_errors" \
+ --expect-failure "$$am__expect_failure"
+# To be inserted before the command running the test. Creates the
+# directory for the log if needed. Stores in $dir the directory
+# containing $f, in $tst the test, in $log the log. Executes the
+# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and
+# passes TESTS_ENVIRONMENT. Set up options for the wrapper that
+# will run the test scripts (or their associated LOG_COMPILER, if
+# thy have one).
+am__check_pre = \
+$(am__sh_e_setup); \
+$(am__vpath_adj_setup) $(am__vpath_adj) \
+$(am__tty_colors); \
+srcdir=$(srcdir); export srcdir; \
+case "$@" in \
+ */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \
+ *) am__odir=.;; \
+esac; \
+test "x$$am__odir" = x"." || test -d "$$am__odir" \
+ || $(MKDIR_P) "$$am__odir" || exit $$?; \
+if test -f "./$$f"; then dir=./; \
+elif test -f "$$f"; then dir=; \
+else dir="$(srcdir)/"; fi; \
+tst=$$dir$$f; log='$@'; \
+if test -n '$(DISABLE_HARD_ERRORS)'; then \
+ am__enable_hard_errors=no; \
+else \
+ am__enable_hard_errors=yes; \
+fi; \
+case " $(XFAIL_TESTS) " in \
+ *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \
+ am__expect_failure=yes;; \
+ *) \
+ am__expect_failure=no;; \
+esac; \
+$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT)
+# A shell command to get the names of the tests scripts with any registered
+# extension removed (i.e., equivalently, the names of the test logs, with
+# the '.log' extension removed). The result is saved in the shell variable
+# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly,
+# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)",
+# since that might cause problem with VPATH rewrites for suffix-less tests.
+# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'.
+am__set_TESTS_bases = \
+ bases='$(TEST_LOGS)'; \
+ bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \
+ bases=`echo $$bases`
+RECHECK_LOGS = $(TEST_LOGS)
+AM_RECURSIVE_TARGETS = check recheck
+TEST_SUITE_LOG = test-suite.log
+TEST_EXTENSIONS = @EXEEXT@ .test
+am__test_logs1 = $(TESTS:=.log)
+am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log)
+TEST_LOGS = $(am__test_logs2:.test.log=.log)
+TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver
+TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \
+ $(TEST_LOG_FLAGS)
+am__set_b = \
+ case '$@' in \
+ */*) \
+ case '$*' in \
+ */*) b='$*';; \
+ *) b=`echo '$@' | sed 's/\.log$$//'`; \
+ esac;; \
+ *) \
+ b='$*';; \
+ esac
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DOXYGEN = @DOXYGEN@
+DOXYGEN_OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+EXTRALO = @EXTRALO@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+KPSEWHICH = @KPSEWHICH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MAKETEXPK_PATH = @MAKETEXPK_PATH@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MKDIR_P = @MKDIR_P@
+MKTEXPK_PATH = @MKTEXPK_PATH@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
+RANLIB = @RANLIB@
+RELEASEDATE = @RELEASEDATE@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+TEX = @TEX@
+VERSION = @VERSION@
+XDVI_PATH = @XDVI_PATH@
+XSLTPROC = @XSLTPROC@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libdvi2bitmap_la_version_info = @libdvi2bitmap_la_version_info@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+CHECK_programs = $(TESTS)
+EXTRA_DIST = t5.dvi modetest.tex modetest-maths.tex
+SUFFIXES = .dvi .dtl
+
+# The dvi2bitmap program we'll use. This is usually the one just built in
+# the parent, but allow this to be overridden.
+DVI2BITMAP = ../dvi2bitmap
+t5_test_LDFLAGS = -lm
+t7_test_LDFLAGS = -lm
+LDADD = ../libdvi2bitmap.la
+AM_CPPFLAGS = -I..
+t1_test_SOURCES = t1.cc
+t2_test_SOURCES = t2.cc
+t3_test_SOURCES = t3.cc
+t4_test_SOURCES = t4.cc
+t5_test_SOURCES = t5.cc
+t6_test_SOURCES = t6.cc
+t7_test_SOURCES = t7.cc
+t8_test_SOURCES = t8.pl
+MOSTLYCLEANFILES = \
+ t6.data \
+ *~ *.o *.lo *.test *.stderr \
+ *.log *.aux *.dvi *.pdf \
+ test-output* temp* \
+ modetest*sampler* \
+ modetest-maths-concmath.tex
+
+CLEANFILES = sampler.tar
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .dvi .dtl .cc .lo .log .o .obj .test .test$(EXEEXT) .trs
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign test/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+t8.pl: $(top_builddir)/config.status $(srcdir)/t8.pl.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+
+t1.test$(EXEEXT): $(t1_test_OBJECTS) $(t1_test_DEPENDENCIES) $(EXTRA_t1_test_DEPENDENCIES)
+ @rm -f t1.test$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t1_test_OBJECTS) $(t1_test_LDADD) $(LIBS)
+
+t2.test$(EXEEXT): $(t2_test_OBJECTS) $(t2_test_DEPENDENCIES) $(EXTRA_t2_test_DEPENDENCIES)
+ @rm -f t2.test$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t2_test_OBJECTS) $(t2_test_LDADD) $(LIBS)
+
+t3.test$(EXEEXT): $(t3_test_OBJECTS) $(t3_test_DEPENDENCIES) $(EXTRA_t3_test_DEPENDENCIES)
+ @rm -f t3.test$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t3_test_OBJECTS) $(t3_test_LDADD) $(LIBS)
+
+t4.test$(EXEEXT): $(t4_test_OBJECTS) $(t4_test_DEPENDENCIES) $(EXTRA_t4_test_DEPENDENCIES)
+ @rm -f t4.test$(EXEEXT)
+ $(AM_V_CXXLD)$(CXXLINK) $(t4_test_OBJECTS) $(t4_test_LDADD) $(LIBS)
+
+t5.test$(EXEEXT): $(t5_test_OBJECTS) $(t5_test_DEPENDENCIES) $(EXTRA_t5_test_DEPENDENCIES)
+ @rm -f t5.test$(EXEEXT)
+ $(AM_V_CXXLD)$(t5_test_LINK) $(t5_test_OBJECTS) $(t5_test_LDADD) $(LIBS)
+
+t7.test$(EXEEXT): $(t7_test_OBJECTS) $(t7_test_DEPENDENCIES) $(EXTRA_t7_test_DEPENDENCIES)
+ @rm -f t7.test$(EXEEXT)
+ $(AM_V_CXXLD)$(t7_test_LINK) $(t7_test_OBJECTS) $(t7_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t3.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t4.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t5.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t6.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t7.Po@am__quote@
+
+.cc.o:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.cc.lo:
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LTCXXCOMPILE) -c -o $@ $<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
+ here=`pwd`; \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+# Recover from deleted '.trs' file; this should ensure that
+# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create
+# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells
+# to avoid problems with "make -n".
+.log.trs:
+ rm -f $< $@
+ $(MAKE) $(AM_MAKEFLAGS) $<
+
+# Leading 'am--fnord' is there to ensure the list of targets does not
+# expand to empty, as could happen e.g. with make check TESTS=''.
+am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck)
+am--force-recheck:
+ @:
+
+$(TEST_SUITE_LOG): $(TEST_LOGS)
+ @$(am__set_TESTS_bases); \
+ am__f_ok () { test -f "$$1" && test -r "$$1"; }; \
+ redo_bases=`for i in $$bases; do \
+ am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \
+ done`; \
+ if test -n "$$redo_bases"; then \
+ redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \
+ redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \
+ if $(am__make_dryrun); then :; else \
+ rm -f $$redo_logs && rm -f $$redo_results || exit 1; \
+ fi; \
+ fi; \
+ if test -n "$$am__remaking_logs"; then \
+ echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \
+ "recursion detected" >&2; \
+ else \
+ am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \
+ fi; \
+ if $(am__make_dryrun); then :; else \
+ st=0; \
+ errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \
+ for i in $$redo_bases; do \
+ test -f $$i.trs && test -r $$i.trs \
+ || { echo "$$errmsg $$i.trs" >&2; st=1; }; \
+ test -f $$i.log && test -r $$i.log \
+ || { echo "$$errmsg $$i.log" >&2; st=1; }; \
+ done; \
+ test $$st -eq 0 || exit 1; \
+ fi
+ @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \
+ ws='[ ]'; \
+ results=`for b in $$bases; do echo $$b.trs; done`; \
+ test -n "$$results" || results=/dev/null; \
+ all=` grep "^$$ws*:test-result:" $$results | wc -l`; \
+ pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \
+ fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \
+ skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \
+ xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \
+ xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \
+ error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \
+ if test `expr $$fail + $$xpass + $$error` -eq 0; then \
+ success=true; \
+ else \
+ success=false; \
+ fi; \
+ br='==================='; br=$$br$$br$$br$$br; \
+ result_count () \
+ { \
+ if test x"$$1" = x"--maybe-color"; then \
+ maybe_colorize=yes; \
+ elif test x"$$1" = x"--no-color"; then \
+ maybe_colorize=no; \
+ else \
+ echo "$@: invalid 'result_count' usage" >&2; exit 4; \
+ fi; \
+ shift; \
+ desc=$$1 count=$$2; \
+ if test $$maybe_colorize = yes && test $$count -gt 0; then \
+ color_start=$$3 color_end=$$std; \
+ else \
+ color_start= color_end=; \
+ fi; \
+ echo "$${color_start}# $$desc $$count$${color_end}"; \
+ }; \
+ create_testsuite_report () \
+ { \
+ result_count $$1 "TOTAL:" $$all "$$brg"; \
+ result_count $$1 "PASS: " $$pass "$$grn"; \
+ result_count $$1 "SKIP: " $$skip "$$blu"; \
+ result_count $$1 "XFAIL:" $$xfail "$$lgn"; \
+ result_count $$1 "FAIL: " $$fail "$$red"; \
+ result_count $$1 "XPASS:" $$xpass "$$red"; \
+ result_count $$1 "ERROR:" $$error "$$mgn"; \
+ }; \
+ { \
+ echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \
+ $(am__rst_title); \
+ create_testsuite_report --no-color; \
+ echo; \
+ echo ".. contents:: :depth: 2"; \
+ echo; \
+ for b in $$bases; do echo $$b; done \
+ | $(am__create_global_log); \
+ } >$(TEST_SUITE_LOG).tmp || exit 1; \
+ mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \
+ if $$success; then \
+ col="$$grn"; \
+ else \
+ col="$$red"; \
+ test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \
+ fi; \
+ echo "$${col}$$br$${std}"; \
+ echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \
+ echo "$${col}$$br$${std}"; \
+ create_testsuite_report --maybe-color; \
+ echo "$$col$$br$$std"; \
+ if $$success; then :; else \
+ echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \
+ if test -n "$(PACKAGE_BUGREPORT)"; then \
+ echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \
+ fi; \
+ echo "$$col$$br$$std"; \
+ fi; \
+ $$success || exit 1
+
+check-TESTS:
+ @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list
+ @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+ log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \
+ exit $$?;
+recheck: all $(check_PROGRAMS)
+ @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+ @set +e; $(am__set_TESTS_bases); \
+ bases=`for i in $$bases; do echo $$i; done \
+ | $(am__list_recheck_tests)` || exit 1; \
+ log_list=`for i in $$bases; do echo $$i.log; done`; \
+ log_list=`echo $$log_list`; \
+ $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \
+ am__force_recheck=am--force-recheck \
+ TEST_LOGS="$$log_list"; \
+ exit $$?
+.test.log:
+ @p='$<'; \
+ $(am__set_b); \
+ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
+@am__EXEEXT_TRUE@.test$(EXEEXT).log:
+@am__EXEEXT_TRUE@ @p='$<'; \
+@am__EXEEXT_TRUE@ $(am__set_b); \
+@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \
+@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \
+@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \
+@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+ -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS)
+ -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs)
+ -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: check-am install-am install-strip
+
+.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool cscopelist-am \
+ ctags ctags-am distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ recheck tags tags-am uninstall uninstall-am
+
+
+# All the tests depend on the library
+$(TESTS): ../libdvi2bitmap.la
+
+.dtl.dvi:
+ dt2dv $< $@ >$@.log 2>&1
+# t8.test is a perl script -- see below
+
+# t8.test is just a link to t8.pl.
+t8.test$(EXEEXT): t8.pl
+ if test -w t8.test; then rm -f t8.test;fi
+ $(LN_S) t8.pl t8.test$(EXEEXT)
+
+# Test 5 depends on its DVI file; test 7 uses it, too
+t5.test$(EXEEXT) t7.test$(EXEEXT): t5.dvi
+
+# t6.test forks and execs itself, so the libtool trick of creating a shell
+# script with the same name, which resolves the shared library dependencies,
+# won't work. Instead link it statically. Note that this fails on Tru64
+# because of some as-yet unintelligible linking problem [FIXME: why doesn't
+# it work on Tru64 -- I can't see the problem in the ld messages]
+# We should, I suppose, use t6_test_LDFLAGS=-all-static here, but that doesn't
+# seem to work on OSX, though the libtool manual says that this is what it's
+# for. Give up, and just do the link by hand [XXX rather bogus, this might
+# possibly fail on other platforms].
+t6.test$(EXEEXT): t6.o
+ $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o t6.test$(EXEEXT) t6.o ../.libs/libdvi2bitmap.a
+
+pathtest: hello.dvi
+ sh ./test-font-gen.sh $(DVI2BITMAP) hello.dvi temp-hello-output
+
+#magtest: magtest.dvi
+# sh ./test-font-gen.sh $(DVI2BITMAP) magtest.dvi temp-magtest-output
+
+modetest: modetest.dvi
+ sh ./test-font-gen.sh $(DVI2BITMAP) modetest.dvi temp-modetest-output
+
+hello.dvi: hello.tex
+ tex hello
+
+testcase-magnification.dvi: testcase-magnification.tex
+ tex testcase-magnification
+
+modetest.dvi: modetest.tex
+ latex modetest
+
+modetest-maths.dvi: modetest-maths.tex
+ latex modetest-maths
+
+modetest-maths-concmath.dvi: modetest-maths-concmath.tex
+ latex '\def\optionswitch{1}\input modetest-maths-concmath.tex '
+
+modetest-maths-concmath.tex: modetest-maths.tex
+ ln -s modetest-maths.tex modetest-maths-concmath.tex
+
+# The sampler relies on scsh to be installed
+%-sampler.html: %.dvi
+ ./make-sampler.scsh -x$(DVI2BITMAP) -o$(@:.html=) -d$< -t$(<:.dvi=.tex)
+
+sampler.tar: sampler.html \
+ modetest-sampler.html \
+ modetest-maths-sampler.html \
+ modetest-maths-concmath-sampler.html \
+ modetest-maths-concmath.tex
+ rm -Rf sampler
+ mkdir sampler
+ cp modetest-sampler.html modetest-maths-sampler.html modetest-maths-concmath-sampler.html sampler
+ cp modetest*.png sampler
+ cp modetest.tex modetest-maths.tex modetest-maths-concmath.tex sampler
+ cp sampler.html sampler
+ tar cf $@ sampler
+ rm -Rf sampler
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/dviware/dvi2bitmap/test/modetest-maths.tex b/dviware/dvi2bitmap/test/modetest-maths.tex
new file mode 100644
index 0000000000..9d5afafc76
--- /dev/null
+++ b/dviware/dvi2bitmap/test/modetest-maths.tex
@@ -0,0 +1,20 @@
+\documentclass{article}
+
+\providecommand{\optionswitch}{0}
+
+\ifcase\optionswitch
+ % no package
+\else
+ \typeout{Using concmath}
+ \usepackage{concmath}
+\fi
+
+\thispagestyle{empty}
+
+\def\maths{%
+\hat f({\bf g})\approx\sqrt{\left\lfloor\int_0^1\frac{\cos\omega}{\varphi^2_i}\,{\rm d}y\right\}
+}}
+
+\begin{document}
+$\maths \to \displaystyle\maths$
+\end{document}
diff --git a/dviware/dvi2bitmap/test/modetest.tex b/dviware/dvi2bitmap/test/modetest.tex
new file mode 100644
index 0000000000..ef4ce0d0b4
--- /dev/null
+++ b/dviware/dvi2bitmap/test/modetest.tex
@@ -0,0 +1,112 @@
+% This is modetest.tex, extracted from the Metafont modes.mf file
+%
+%
+%
+% modetest.tex -- a file to test a METAFONT mode
+%
+% by Matt Swift <swift@bu.edu>
+%
+% This file is in the public domain.
+%
+% \def\fileversion{v1.2}
+% \def\filedate{1995/12/31}
+%
+% This LaTeX 2e file generates a test page useful for finding a good
+% METAFONT mode for your printer. It includes the most sensitive
+% letters in three sizes and all standard CMR font shapes.
+%
+% I've made the macros abstract, and I think this file could easily
+% be adapted to test modes for other METAFONT fonts, or simply font
+% appearance in general.
+%
+% If you want to adapt this to a non-LaTeX format, the LaTeX-specific
+% commands below that must be altered are \documentclass,
+% \begin{document}, \end{document}, \makeatletter, \makeatother,
+% \@for, \@setfontsize, \encodingdefault, \pagestyle, \normalfont,
+% \rmfamily, \sffamily, \ttfamily, \mdseries, \bfseries, \upshape,
+% \itshape, \scshape, and \slshape.
+%%
+%\def\encodingdefault{T1} % New "Cork" font encoding (dc fonts).
+%\def\encodingdefault{OT1} % Old font encoding (cm fonts).
+%%
+\documentclass{article}
+\begin{document}
+%%
+% This line can be replaced (by, e.g., sed) to contain a mode name.
+%%
+%::Mode::
+%ibmvga, 110dpi
+%%
+\def\makesize#1#2#3{
+ \expandafter\def\csname ptsize#1\endcsname{#2}
+ \expandafter\def\csname blsize#1\endcsname{#3}
+}
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% DEFINE HERE THE POINT SIZES with baselineskips you would like to test. %
+% With the defaults of 5, 10, and 14 point sizes, everything will fit on %
+% one page very easily. Twocolumn would allow several more sizes. %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+\makesize {A}{5}{6}
+\makesize {B}{10}{12}
+\makesize {C}{14}{18}
+%%
+%\def\sizelist{A,B,C}
+\def\sizelist{B}
+%%
+\def\letters{%
+MoOzZffii-a\"egsS [/$\backslash$\par
+}
+\def\maths{%
+\hat f({\bf g})\approx\sqrt{\left\lfloor\int_0^1\frac{\cos\omega}{\varphi^2_i}\,{\rm d}y\right\}
+}}
+%%
+\makeatletter
+\let\setfontsize\@setfontsize
+\let\for\@for
+\parindent\z@
+\makeatother
+%%
+\pagestyle{empty}
+%%
+\def\showfonts{%
+%
+% The groups prevent warnings when intermediate fonts are not available.
+%
+{\rmfamily \mdseries \upshape \letters} % allow no space before this
+ {\rmfamily \mdseries \slshape \letters}
+ {\rmfamily \mdseries \itshape \letters}
+ {\rmfamily \mdseries \scshape \letters}
+%%
+ {\rmfamily \bfseries \upshape \letters}
+ {\rmfamily \bfseries \slshape \letters}
+ {\rmfamily \bfseries \itshape \letters}
+%%
+ {\sffamily \mdseries \upshape \letters}
+ {\sffamily \mdseries \slshape \letters}
+%%
+ {\sffamily \bfseries \upshape \letters}
+%%
+ {\ttfamily \mdseries \upshape \letters}
+ {\ttfamily \mdseries \slshape \letters}
+ {\ttfamily \mdseries \itshape \letters}
+ {\ttfamily \mdseries \scshape \letters}
+ {$\maths\to \displaystyle \maths$}
+}
+%%
+% The \expandafters expand \sizelist.
+%
+\expandafter \for
+\expandafter \sizename
+\expandafter :%
+\expandafter =%
+ \sizelist
+ \do {\setfontsize {\sizename}
+ {\csname ptsize\sizename\endcsname}
+ {\csname blsize\sizename\endcsname}%
+ \vskip 1ex\noindent
+ \llap{\normalfont\csname ptsize\sizename \endcsname\,pt\quad}%
+ \showfonts}
+%%
+\end{document}
diff --git a/dviware/dvi2bitmap/test/t1.cc b/dviware/dvi2bitmap/test/t1.cc
new file mode 100644
index 0000000000..e4a3c18586
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t1.cc
@@ -0,0 +1,127 @@
+// Testing Util
+
+#include <config.h>
+
+#include <iostream>
+
+#if HAVE_CSTD_INCLUDE
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+using STD::cout;
+using STD::cerr;
+using STD::endl;
+
+#include <string>
+
+#include <verbosity.h>
+#include <Util.h>
+
+
+
+int nfails = 0;
+char *progname;
+
+void compare_string_list(string_list& expected, string_list& actual);
+void Usage(void);
+
+void compare_string_list(string_list& expected, string_list& actual)
+{
+ string_list::const_iterator cie = expected.begin();
+ string_list::const_iterator cia = actual.begin();
+
+ while (! (cie == expected.end() || cia == actual.end())) {
+ if (*cie != *cia) {
+ nfails++;
+ cerr << "(list) Expected " << *cie
+ << ", got " << *cia
+ << endl;
+ }
+ cie++;
+ cia++;
+ }
+
+ if (cia != actual.end()) {
+ nfails++;
+ cerr << "(list) more actual (" << *cia << ") than expected" << endl;
+ }
+ if (cie != expected.end()) {
+ nfails++;
+ cerr << "(list) more expected (" << *cia << ") than actual" << endl;
+ }
+}
+
+void compare_string_array(string_list& expected, char** actual)
+{
+ string_list::const_iterator cie = expected.begin();
+ char** ap = actual;
+
+ while (! (cie == expected.end() || *ap == 0)) {
+ if (*cie != *ap) {
+ nfails++;
+ cerr << "(array) Expected " << *cie
+ << ", got " << *ap
+ << endl;
+ }
+ cie++;
+ ap++;
+ }
+
+ if (*ap != 0) {
+ nfails++;
+ cerr << "(array) more actual (" << *ap << ") than expected" << endl;
+ }
+ if (cie != expected.end()) {
+ nfails++;
+ cerr << "(array) more expected (" << *cie << ") than actual" << endl;
+ }
+}
+
+
+int main (int argc, char **argv)
+{
+ progname = argv[0];
+
+ for (argc--, argv++; argc>0; argc--, argv++)
+ if (**argv == '-') {
+ switch (*++*argv) {
+ case 'v': // verbose
+ Util::verbosity (debug);
+ break;
+ default:
+ Usage();
+ }
+ } else {
+ Usage();
+ }
+
+ string_list res;
+
+ res.push_back("one");
+ res.push_back("two");
+ res.push_back("three");
+ string_list sl = Util::tokenise_string("one two three");
+ char **sa = Util::string_list_to_array(sl);
+ compare_string_list(res, sl);
+ compare_string_array(res, sa);
+ Util::delete_string_array(sa);
+
+ res.clear();
+ res.push_back("hello");
+ res.push_back("there");
+ sl = Util::tokenise_string(" hello there ");
+ sa = Util::string_list_to_array(sl);
+ compare_string_list(res, sl);
+ compare_string_array(res, sa);
+ Util::delete_string_array(sa);
+
+ STD::exit (nfails);
+}
+
+void Usage(void)
+{
+ cerr << "Usage: " << progname << " [-v]" << endl;
+ STD::exit (1);
+}
diff --git a/dviware/dvi2bitmap/test/t2.cc b/dviware/dvi2bitmap/test/t2.cc
new file mode 100644
index 0000000000..ff7091b927
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t2.cc
@@ -0,0 +1,100 @@
+
+#include "config.h"
+
+#include <iostream>
+
+#if HAVE_CSTD_INCLUDE
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+#include <string>
+
+using STD::cerr;
+using STD::cout;
+using STD::exit;
+using STD::endl;
+using STD::string;
+
+#include "PkFont.h"
+
+void Usage(void);
+
+struct {
+ string fmt;
+ string mode;
+ string fontname;
+ int dpi;
+ int basedpi;
+ double magnification;
+ string expected; // zero-length if it should fail
+} tests[] = {
+ { "f=%f m=%m b=%b d=%d M=%M %%", "ibmvga", "cmr10", 330, 110, 3.0,
+ "f=cmr10 m=3 b=110 d=330 M=ibmvga %" },
+ { "%f%m%b%d%M", "ibmvga", "cmr10", 330, 110, 3.0,
+ "cmr103110330ibmvga", },
+ { "%f-%f-%%f%%%f", "ibmvga", "cmr10", 330, 110, 3.0,
+ "cmr10-cmr10-%f%cmr10", },
+ { "%f-%f-%%f%x%f", "ibmvga", "cmr10", 330, 110, 3.0,
+ "", }, // fails -- has %x specifier
+};
+int ntests = sizeof(tests)/sizeof(tests[0]);
+
+char *progname;
+
+int main (int argc, char **argv)
+{
+ progname = argv[0];
+
+ for (argc--, argv++; argc>0; argc--, argv++)
+ if (**argv == '-') {
+ switch (*++*argv) {
+ case 'v': // verbose
+ PkFont::verbosity (debug);
+ break;
+ default:
+ Usage();
+ }
+ } else {
+ Usage();
+ }
+
+ int i;
+ int nfails = 0;
+
+ for (i=0; i<ntests; i++) {
+ try {
+ string res = PkFont::substitute_font_string
+ (tests[i].fmt, tests[i].mode, tests[i].fontname,
+ tests[i].dpi, tests[i].basedpi, tests[i].magnification);
+ if (tests[i].expected.length() == 0) {
+ // should have failed
+ nfails++;
+ cerr << "Test " << i
+ << " should have thrown an exception, but got <"
+ << res << "> instead" << endl;
+ } else if (res != tests[i].expected) {
+ nfails++;
+ cerr << "Test " << i << ": expected <" << tests[i].expected
+ << ">, got <" << res << ">" << endl;
+ }
+ } catch (PkError& e) {
+ if (tests[i].expected.length() != 0) {
+ // should have succeeded
+ nfails++;
+ cerr << "Test " << i << ": expected <"
+ << tests[i].expected << ">, but got exception" << endl;
+ }
+ }
+ }
+
+ exit (nfails);
+}
+
+
+void Usage(void)
+{
+ cerr << "Usage: " << progname << " [-v]" << endl;
+ exit (1);
+}
diff --git a/dviware/dvi2bitmap/test/t3.cc b/dviware/dvi2bitmap/test/t3.cc
new file mode 100644
index 0000000000..9bc6fd8b6b
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t3.cc
@@ -0,0 +1,173 @@
+
+#include "config.h"
+
+#include <iostream>
+#include <string>
+
+
+#if HAVE_CSTD_INCLUDE
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+using STD::cerr;
+using STD::cout;
+using STD::exit;
+using STD::endl;
+using STD::string;
+
+#include "PageRange.h"
+
+int usecounts;
+int nfails = 0;
+
+int counts[] = { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0};
+
+#if 0
+char sel(PageRange&, int i);
+char sel(PageRange& p, int i)
+{
+ if (usecounts >= 0) {
+ counts[usecounts] = i;
+ return p.isSelected(1, counts) ? '+' : '-';
+ } else {
+ counts[0] = 1;
+ return p.isSelected(i, counts) ? '+' : '-';
+ }
+}
+
+void show_selections(PageRange& pr, string prefix, int from, int to)
+{
+ cout << prefix;
+ for (; from <= to; from++)
+ cout << ' ' << from << sel(pr, from);
+ cout << endl;
+ return;
+}
+#endif
+
+// If issel is true, assert that page i is selected in the pagerange p
+// If global usecounts is >=0 then set counts[usecounts] to number i and
+// test that (the DVI sequence number which is the first argument to
+// isSelected is then irrelevant).
+void sel(string label, PageRange& p, int i, bool issel);
+void sel(string label, PageRange& p, int i, bool issel)
+{
+ int testn;
+
+ if (usecounts >= 0) {
+ counts[usecounts] = i;
+ testn = 1;
+ } else {
+ counts[0] = 1;
+ testn = i;
+ }
+
+ if (issel) {
+ if (!p.isSelected(testn, counts)) {
+ cerr << label << ": page " << testn << " unselected" << endl;
+ nfails++;
+ }
+ } else {
+ if (p.isSelected(testn, counts)) {
+ cerr << label << ": page " << testn << " selected" << endl;
+ nfails++;
+ }
+ }
+}
+
+int main (int argc, char **argv)
+{
+ usecounts = -1;
+ PageRange pr1;
+ sel("1-1", pr1, 4, true);
+ sel("1-1", pr1, 5, true);
+ sel("1-1", pr1, 6, true);
+ sel("1-1", pr1, 7, true);
+
+ pr1.addSpec('p', "=5");
+ sel("1-2", pr1, 4, false);
+ sel("1-2", pr1, 5, true);
+ sel("1-2", pr1, 6, true);
+ sel("1-2", pr1, 7, true);
+
+ pr1.addSpec('l', "=6");
+ sel("1-3", pr1, 4, false);
+ sel("1-3", pr1, 5, true);
+ sel("1-3", pr1, 6, true);
+ sel("1-3", pr1, 7, false);
+
+ PageRange pr2;
+ pr2.addSpec('P', "=3,5-7");
+ sel("2", pr2, 1, false);
+ sel("2", pr2, 2, false);
+ sel("2", pr2, 3, true);
+ sel("2", pr2, 4, false);
+ sel("2", pr2, 5, true);
+ sel("2", pr2, 6, true);
+ sel("2", pr2, 7, true);
+ sel("2", pr2, 8, false);
+
+ usecounts = 0;
+ PageRange pr3;
+ sel("3-1", pr3, 4, true);
+ sel("3-1", pr3, 5, true);
+ sel("3-1", pr3, 6, true);
+ sel("3-1", pr3, 7, true);
+
+ pr3.addSpec('p', "5");
+ sel("3-2", pr3, 4, false);
+ sel("3-2", pr3, 5, true);
+ sel("3-2", pr3, 6, true);
+ sel("3-2", pr3, 7, true);
+
+ pr3.addSpec('l', "6");
+ sel("3-3", pr3, 4, false);
+ sel("3-3", pr3, 5, true);
+ sel("3-3", pr3, 6, true);
+ sel("3-3", pr3, 7, false);
+
+ PageRange pr4;
+ pr4.addSpec('P', "3,5-7");
+ sel("4", pr4, 1, false);
+ sel("4", pr4, 2, false);
+ sel("4", pr4, 3, true);
+ sel("4", pr4, 4, false);
+ sel("4", pr4, 5, true);
+ sel("4", pr4, 6, true);
+ sel("4", pr4, 7, true);
+ sel("4", pr4, 8, false);
+
+ usecounts = 4;
+ PageRange pr5;
+ sel("5-1", pr5, 4, true);
+ sel("5-1", pr5, 5, true);
+ sel("5-1", pr5, 6, true);
+ sel("5-1", pr5, 7, true);
+
+ pr5.addSpec('p', ":4:5");
+ sel("5-2", pr5, 4, false);
+ sel("5-2", pr5, 5, true);
+ sel("5-2", pr5, 6, true);
+ sel("5-2", pr5, 7, true);
+
+ pr5.addSpec('l', ":4:6");
+ sel("5-3", pr5, 4, false);
+ sel("5-3", pr5, 5, true);
+ sel("5-3", pr5, 6, true);
+ sel("5-3", pr5, 7, false);
+
+ PageRange pr6;
+ pr6.addSpec('P', ":4:3,5-7");
+ sel("6", pr6, 1, false);
+ sel("6", pr6, 2, false);
+ sel("6", pr6, 3, true);
+ sel("6", pr6, 4, false);
+ sel("6", pr6, 5, true);
+ sel("6", pr6, 6, true);
+ sel("6", pr6, 7, true);
+ sel("6", pr6, 8, false);
+
+ exit(nfails);
+}
diff --git a/dviware/dvi2bitmap/test/t4.cc b/dviware/dvi2bitmap/test/t4.cc
new file mode 100644
index 0000000000..19d6dbea32
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t4.cc
@@ -0,0 +1,94 @@
+#include "config.h"
+#include <iostream>
+
+#include "Util.h"
+
+#if HAVE_CSTD_INCLUDE
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+using STD::cerr;
+using STD::cout;
+using STD::exit;
+using STD::endl;
+
+struct {
+ const char* testcase;
+ int expectedR; // negative if expected bad
+ int expectedG;
+ int expectedB;
+} tests[] = {
+ { "1/2/3", 1, 2, 3, },
+ { "077;0177;0xff", 63, 127, 255, },
+ { "256,0,0", -1, -1, -1, },
+ { " 1 2 3 ", 1, 2, 3, },
+ { "#cc77ff", 204, 119, 255, },
+ { " #007f0c", 0, 127, 12, },
+};
+int ntests = sizeof(tests)/sizeof(tests[0]);
+
+#if 0
+void reportRGB(char *spec)
+{
+ Bitmap::BitmapColour rgb;
+ bool res;
+ res = Util::parseRGB(rgb, spec);
+ cout << spec;
+ if (res)
+ cout << "-->"
+ << (int)rgb.red << ' '
+ << (int)rgb.green << ' '
+ << (int)rgb.blue << endl;
+ else
+ cout << " bad" << endl;
+}
+#endif
+
+int main (int argc, char **argv)
+{
+ int i;
+ int nfails = 0;
+
+ for (i=0; i<ntests; i++) {
+ Bitmap::BitmapColour rgb;
+ bool res;
+ res = Util::parseRGB(rgb, tests[i].testcase);
+ if (res) {
+ if (tests[i].expectedR < 0) {
+ // was expected to fail
+ cerr << "Test " << i << " unexpectedly succeeded: "
+ << (int)rgb.red << ','
+ << (int)rgb.green << ','
+ << (int)rgb.blue << endl;
+ nfails++;
+ } else {
+ if (tests[i].expectedR != (int)rgb.red
+ || tests[i].expectedG != (int)rgb.green
+ || tests[i].expectedB != (int)rgb.blue) {
+ cerr << "Test " << i << ": expected "
+ << tests[i].expectedR << ','
+ << tests[i].expectedG << ','
+ << tests[i].expectedB
+ << ", got "
+ << (int)rgb.red << ','
+ << (int)rgb.green << ','
+ << (int)rgb.blue << endl;
+ nfails++;
+ }
+ }
+ } else {
+ // test failed
+ if (tests[i].expectedR >= 0) {
+ // was expected to succeed
+ cerr << "Test " << i << ", spec=<" << tests[i].testcase
+ << "> unexpectedly failed" << endl;
+ nfails++;
+ }
+ }
+ }
+
+ exit(nfails);
+}
+
diff --git a/dviware/dvi2bitmap/test/t5.cc b/dviware/dvi2bitmap/test/t5.cc
new file mode 100644
index 0000000000..a350d0853c
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t5.cc
@@ -0,0 +1,321 @@
+// Testing Bitmap
+
+#include <config.h>
+#include <iostream>
+
+#include <DviFile.h>
+#include <PkFont.h>
+#include <Bitmap.h>
+
+#if HAVE_CSTD_INCLUDE
+#include <cstdlib>
+#else
+#include <stdlib.h>
+#endif
+
+using STD::cerr;
+using STD::cout;
+using STD::exit;
+using STD::endl;
+
+#define CHECKNEXTFONT(iter,checkname) \
+ if (iter == fs->end()) { \
+ cerr << "Unexpected end of list: expected " \
+ << checkname << ", but got nothing" \
+ << endl; \
+ nfails++; \
+ } else { \
+ f = *iter; \
+ if (f->name() != checkname) { \
+ cerr << "Unexpected font: was " << f->name() \
+ << ", expected " << checkname << endl; \
+ nfails++; \
+ } \
+ } \
+ if (iter != fs->end()) \
+ ++iter;
+
+#define CHECKBB(context,bb0,bb1,bb2,bb3) \
+ { \
+ int exp[] = {bb0,bb1,bb2,bb3}; \
+ for (int ti=0; ti<4; ti++) \
+ if (bb[ti] != exp[ti]) { \
+ cerr << context \
+ << ": unexpected value of bb[" << ti << "]: expected " \
+ << exp[ti] << ", got " << bb[ti] << endl; \
+ nfails++; \
+ } \
+ }
+
+#define CHECKINT(context,expected,actual) \
+ if ((expected) != (actual)) { \
+ cerr << context << ": expected " << (expected) \
+ << ", got " << (actual) << endl; \
+ nfails++; \
+ }
+
+
+#define NBITMAPROWS 10
+#define NBITMAPCOLS 20
+// Note that bitmap coordinates have (0,0) at the top left, so
+// this result picture, and the F[] array below, are both right way up
+const char *picture[NBITMAPROWS] = {
+ " **",
+ " **",
+ " ***** **",
+ " * * ",
+ " * * ********** ",
+ " ********** ",
+ " ",
+ " ",
+ " ",
+ "*** ",
+};
+const char *picturePostCrop[NBITMAPROWS] = {
+ " **",
+ " **",
+ " ***** **",
+ " * * ",
+ " * * ********** ",
+ " ********** ",
+};
+const char *pictureLarge[2*NBITMAPROWS] = {
+ " ",
+ " ",
+ " ***** ***** ",
+ " * * * * ",
+ " * * ********** * * **",
+ " ********** * ",
+ " * ",
+ " ",
+ " ",
+ "*** ",
+ "*** ",
+ "*** ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+};
+const char *pictureSmall[20] = {
+ " ",
+ " ",
+ " ",
+ " ",
+ " ***** ",
+ " ***** ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+};
+const char *pictureSmallCrop[4] = {
+ " ",
+ " ***** ",
+ " ***** ",
+ " ",
+};
+const char *pictureSmallCropStrut[] = {
+ " *****",
+ " *****",
+ " ",
+ " ",
+ " ",
+};
+const Byte F[] = { 1,1,1,1,1,
+ 1,0,1,0,0,
+ 1,0,1,0,0, };
+
+int nfails = 0;
+
+void compareBitmaps(Bitmap *testB, const char **picture,
+ const int ncols, const int nrows,
+ bool showActual=false)
+{
+ Byte *row;
+ int rown = 0;
+ if (showActual) {
+ for (Bitmap::const_iterator bi = testB->begin();
+ bi != testB->end();
+ ++bi) {
+ row = *bi;
+ for (int i=0; i<ncols; i++)
+ cerr << (row[i] ? '*' : ' ');
+ cerr << endl;
+ }
+ }
+ for (Bitmap::const_iterator bi = testB->begin();
+ bi != testB->end();
+ ++bi) {
+ if (rown >= nrows) {
+ cerr << "Oooops, we've received more bitmap rows than we should"
+ << endl;
+ nfails++;
+ } else {
+ row = *bi;
+ for (int i=0; i<ncols; i++) {
+ if ((row[i] != 0) != (picture[rown][i] != ' ')) {
+ cerr << "Row " << rown << ": expected" << endl
+ << " <" << picture[rown] << ">, got" << endl
+ << " <";
+ for (int j=0; j<ncols; j++)
+ cerr << (row[j] ? '*' : ' ');
+ cerr << ">" << endl;
+ nfails++;
+ break;
+ }
+ }
+ }
+ rown++;
+ }
+ if (rown != nrows) {
+ cerr << "At end of iterator, should have " << nrows << " rows, have "
+ << rown << " instead" << endl;
+ nfails++;
+ }
+}
+
+int main (int argc, char** argv)
+{
+ try {
+ string arg;
+ if (argc > 1)
+ arg = argv[1];
+ else
+ arg = "t5.dvi";
+ //DviFile *dvif = new DviFile(argc > 1 ? argv[1] : "t5.dvi",
+ DviFile *dvif = new DviFile(arg,
+ PkFont::dpiBase(), // resolution
+ 1.0, // overall magnification
+ true); // read postamble
+ const DviFile::FontSet* fs = dvif->getFontSet();
+
+ DviFile::FontSet::const_iterator dvii = fs->begin();
+ const PkFont* f;
+ CHECKNEXTFONT(dvii,"cmr10");
+ CHECKNEXTFONT(dvii,"cmcsc10");
+ if (dvii != fs->end()) {
+ f = *dvii;
+ cerr << "Expected end of list, but got font "
+ << f->name() << " instead" << endl;
+ nfails++;
+ }
+
+ //Bitmap::verbosity(debug);
+
+ int bw = NBITMAPCOLS;
+ int bh = NBITMAPROWS;
+ Bitmap *b = new Bitmap(bw, bh, 1, false);
+ b->rule(5, 5, 10, 2);
+ b->rule(-2, 11, 5, 3); // partly off the bitmap, to bottom-left
+ b->rule(18, 2, 5, 3); // ...to top-right
+ b->rule(-5, 0, 2, 2); // completely off, to left
+ b->rule(21, 5, 2, 2); // ...to right
+ b->paint(1, 2, 5, 3, F);
+
+ int* bb;
+ b->freeze();
+ bb = b->boundingBox();
+ CHECKBB("picture", 0, 0, NBITMAPCOLS, NBITMAPROWS);
+ // cerr << "BB: L=" << bb[0] << " T=" << bb[1]
+ // << " R=" << bb[2] << " B=" << bb[3]
+ // << endl;
+
+ compareBitmaps(b, picture, bw, bh);
+
+ // Now crop
+
+ b->crop(Bitmap::Left, 2);
+ b->crop(Bitmap::Bottom, 6, true);
+ b->crop();
+ bb = b->boundingBox();
+ CHECKBB("postcrop", 0, 0, NBITMAPCOLS, 6);
+ compareBitmaps(b, picturePostCrop, bw, 6);
+ // cerr << "BB: L=" << bb[0] << " T=" << bb[1]
+ // << " R=" << bb[2] << " B=" << bb[3]
+ // << endl;
+ // for (Bitmap::iterator bi = b->begin();
+ // bi != b->end();
+ // ++bi) {
+ // Byte* row = *bi;
+ // for (int i=0; i<bw; i++)
+ // cerr << (row[i] ? '*' : ' ');
+ // cerr << endl;
+ // }
+
+ delete b;
+
+
+ b = new Bitmap(bw, bh, 1, true, 2*bw);
+ b->rule(5, 5, 10, 2);
+ b->paint(1, 2, 5, 3, F); // no need for expansion
+ b->paint(32, 2, 5, 3, F); // bitmap needs to expand
+ b->paint(38, 4, 5, 3, F); // ...but not by this much
+ b->rule(-2, 11, 5, 3); // expand in y direction
+
+ b->freeze();
+ bb = b->boundingBox();
+ CHECKBB("large", 0, 2, 40, 12);
+ compareBitmaps(b, pictureLarge, 40, 15);
+
+ b->clear();
+ b->rule(3,5,5,2);
+ b->freeze();
+ bb = b->boundingBox();
+ CHECKBB("small", 3, 4, 8, 6);
+ CHECKINT("bb[2]-bb[0]", 5, bb[2]-bb[0]);
+ CHECKINT("bb[3]-bb[1]", 2, bb[3]-bb[1]);
+ compareBitmaps(b, pictureSmall, 20, 15);
+ // bitmap still expanded size, 15
+
+ b->crop(Bitmap::All, 1);
+ b->crop();
+ bb = b->boundingBox();
+ CHECKBB("smallcrop", 2, 3, 9, 7);
+ CHECKINT("bb[2]-bb[0]", 7, bb[2]-bb[0]);
+ CHECKINT("bb[3]-bb[1]", 4, bb[3]-bb[1]);
+ compareBitmaps(b, pictureSmallCrop, bb[2]-bb[0], bb[3]-bb[1]);
+
+ // same picture -- `small' -- but this time with a strut
+ b->clear();
+ b->strut(3,5,0,5,2,0);
+ bb = b->boundingBox();
+ CHECKBB("smallStrut1", 3, 4, 8, 6); // same bb as rule(3,5,5,2)
+ b->rule(3,5,5,2);
+ bb = b->boundingBox();
+ CHECKBB("smallStrut2", 3, 4, 8, 6); // unchanged
+ b->strut(4,4,3,0,1,3);
+ b->freeze();
+ bb = b->boundingBox();
+ CHECKBB("smallStrut3", 1, 4, 8, 8);
+ CHECKINT("bb[2]-bb[0]", 7, bb[2]-bb[0]);
+ CHECKINT("bb[3]-bb[1]", 4, bb[3]-bb[1]);
+ compareBitmaps(b, pictureSmall, 20, 15);
+
+ b->crop();
+ bb = b->boundingBox();
+ CHECKBB("smallStrutCrop", 1, 4, 8, 8);
+ CHECKINT("bb[2]-bb[0]", 7, bb[2]-bb[0]);
+ CHECKINT("bb[3]-bb[1]", 4, bb[3]-bb[1]);
+ compareBitmaps(b, pictureSmallCropStrut, bb[2]-bb[0], bb[3]-bb[1]);
+
+ } catch (DviError& e) {
+ cerr << "Caught DviError: " << e.problem() << endl;
+ }
+
+ exit (nfails);
+}
diff --git a/dviware/dvi2bitmap/test/t5.dvi b/dviware/dvi2bitmap/test/t5.dvi
new file mode 100644
index 0000000000..c3bf87dfa4
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t5.dvi
Binary files differ
diff --git a/dviware/dvi2bitmap/test/t6.cc b/dviware/dvi2bitmap/test/t6.cc
new file mode 100644
index 0000000000..0ef74bcec9
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t6.cc
@@ -0,0 +1,714 @@
+// Testing InputByteStream
+
+#include <config.h>
+
+#include <InputByteStream.h>
+#include <FileByteStream.h>
+#include <PipeStream.h>
+#include <stringstream.h>
+
+#include <iostream>
+
+#if HAVE_CSTD_INCLUDE
+# include <cstring>
+# include <cstdio>
+# include <cstdlib>
+# include <cerrno>
+#else
+# include <string.h>
+# include <stdio.h>
+# include <stdlib.h>
+# include <errno.h>
+#endif
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/wait.h>
+#include <sys/stat.h> // for mkfifo
+
+#if HAVE_SYS_ERRNO_H
+/* If it's available, explicitly include sys/errno.h as well as
+ * <cerrno> or <errno.h> above. If we're compiling in a strict-ansi
+ * mode, the compiler may well have carefully avoided defining errors
+ * which are specific to Unix/POSIX, which are, of course, precisely
+ * the ones we're hoping to use.
+ */
+# include <sys/errno.h>
+#endif
+
+
+using STD::cout; // we use these ones a lot
+using STD::cerr;
+using STD::endl;
+using STD::ends;
+using STD::strerror;
+
+#include <string>
+
+#include <verbosity.h>
+
+int totalfails = 0;
+verbosities verbosity = normal;
+char *progname;
+
+void compareStrings(string expected, string actual, int& nfails);
+void checkEOF(InputByteStream& IBS)
+ throw (InputByteStreamError);
+int exercise_IBS(InputByteStream& IBS);
+int exercise_FBS(FileByteStream& FBS);
+void generate_data(int num, FILE* f);
+void echo_envvars(int argc, char** argv);
+int do_stream_tests();
+int do_pipe_tests();
+void Usage();
+
+// clear() method is standard, but not all compilers support it
+#if HAVE_STRING_CLEAR
+# define CLEARSTRING(s) (s).clear()
+#else
+// Let's hope we have erase() (following is the standard's def'n of clear())
+# define CLEARSTRING(s) (s).erase((s).begin(), (s).end())
+#endif
+
+void compareStrings(string expected, string actual, int& nfails)
+{
+ if (verbosity > normal)
+ cerr << "Looking for " << expected << endl;
+
+ if (expected != actual) {
+ cerr << "Expected <" << expected << ">, got <" << actual << ">"
+ << endl;
+ nfails++;
+ }
+}
+
+void checkEOF(InputByteStream& IBS)
+ throw (InputByteStreamError)
+{
+ if (IBS.eof())
+ throw InputByteStreamError("Unexpected EOF");
+}
+
+string report_on_status(int status)
+{
+ SSTREAM res;
+
+ if (WIFEXITED(status)) {
+ res << "Normal exit: status=" << WEXITSTATUS(status)
+ << (WEXITSTATUS(status) == 0 ? " (success)" : " (abnormal)");
+ } else if (WIFSIGNALED(status)) {
+ // if the command fails we may come here
+ res << "Terminated by signal " << WTERMSIG(status);
+#ifdef WCOREDUMP
+ res << (WCOREDUMP(status) ? " (coredump)" : " (no coredump)");
+#endif
+ } else if (WIFSTOPPED(status)) {
+ res << "Stopped on signal " << WSTOPSIG(status);
+ } else {
+ res << "Impossible status " << status;
+ }
+ return SS_STRING(res);
+}
+
+
+int exercise_IBS(InputByteStream& IBS)
+{
+ string teststring;
+ int nfails = 0;
+ int i;
+ const Byte* block;
+
+ try {
+
+ for (i=0; i<10; i++) {
+ teststring += IBS.getByte();
+ }
+ checkEOF(IBS);
+ compareStrings("!000:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ IBS.skip(85); // now at pos 95
+ for (i=0; i<10; i++)
+ teststring += IBS.getByte(); // read over buffer end
+ checkEOF(IBS);
+ compareStrings("56789!100:", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ IBS.skip(45); // skip to buffer end
+ for (i=0; i<10; i++)
+ teststring += IBS.getByte();
+ checkEOF(IBS);
+ compareStrings("!150:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ IBS.skip(35); // now at pos 195
+ block = IBS.getBlock(10);
+ for (i=0; i<10; i++)
+ teststring += *block++; // read block over buffer end
+ checkEOF(IBS);
+ compareStrings("56789!200:", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ IBS.skip(5); // to 210
+ block = IBS.getBlock(10); // to 220
+ for (i=0; i<10; i++)
+ teststring += *block++;
+ checkEOF(IBS);
+ compareStrings("!210:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ block = IBS.getBlock(120); // block bigger than bufsize; to 340
+ checkEOF(IBS);
+ for (i=0; i<10; i++)
+ teststring += *block++;
+ compareStrings("!220:56789", teststring, nfails);
+
+
+ CLEARSTRING(teststring);
+ IBS.skip(55); // to 395
+ block = IBS.getBlock(10); // to 405
+ checkEOF(IBS);
+ for (i=0; i<10; i++)
+ teststring += *block++;
+ compareStrings("56789!400:", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ for (i=0; i<10; i++)
+ teststring += IBS.getByte(); // to 415
+ checkEOF(IBS);
+ compareStrings("56789!410:", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ IBS.skip(75); // to 490
+ for (i=0; i<10; i++)
+ teststring += IBS.getByte();
+ compareStrings("!end:56789", teststring, nfails);
+
+ } catch (DviError& e) {
+ cerr << "DviError: " << e.problem() << endl;
+ nfails++;
+ }
+
+ return nfails;
+}
+
+int exercise_FBS(FileByteStream& FBS)
+{
+ string teststring;
+ int nfails = 0;
+ int i;
+ const Byte* block;
+
+ try {
+ CLEARSTRING(teststring);
+ FBS.seek(0);
+ for (i=0; i<10; i++)
+ teststring += FBS.getByte();
+ checkEOF(FBS);
+ compareStrings("!000:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ FBS.seek(45);
+ for (i=0; i<10; i++)
+ teststring += FBS.getByte();
+ checkEOF(FBS);
+ compareStrings("56789!050:", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ FBS.seek(40);
+ block = FBS.getBlock(20);
+ checkEOF(FBS);
+ for (i=0; i<20; i++)
+ teststring += *block++;
+ compareStrings("!040:56789!050:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ FBS.seek(-10);
+ block = FBS.getBlock(10);
+ for (i=0; i<10; i++)
+ teststring += *block++;
+ compareStrings("!end:56789", teststring, nfails);
+
+ CLEARSTRING(teststring);
+ FBS.seek(-10);
+ for (i=0; i<10; i++)
+ teststring += FBS.getByte();
+ compareStrings("!end:56789", teststring, nfails);
+
+ Byte last = FBS.getByte(); // read past EOF
+ if (last != 0) {
+ cerr << "Expected last-byte=0, got " << last << endl;
+ nfails++;
+ }
+ if (! FBS.eof()) {
+ cerr << "Expected EOF, didn't get it" << endl;
+ nfails++;
+ }
+
+ CLEARSTRING(teststring);
+ FBS.seek(0);
+ for (i=0; i<10; i++)
+ teststring += FBS.getByte();
+ checkEOF(FBS);
+ compareStrings("!000:56789", teststring, nfails);
+
+ } catch (DviError& e) {
+ cerr << "DviError: " << e.problem() << endl;
+ nfails++;
+ }
+
+ return nfails;
+}
+
+void generate_data(int num, FILE *o)
+{
+ int i;
+ for (i=0; i <= num - 20; i+=10) {
+ fprintf(o, "!%03d:56789", i);
+ }
+ fprintf(o, "!end:56789");
+ i += 10;
+ for (int j=0; i<num; j++, i++)
+ fprintf(o, "%d", j);
+}
+
+void echo_envvars(int argc, char** argv)
+{
+ if (argc == 0)
+ printf("SHELL=%s\n", getenv("SHELL"));
+ else {
+ for (; argc>0; argc--, argv++) {
+ const char* p = getenv(*argv);
+ printf("%s=%s!", *argv, (p==0 ? "" : p));
+ }
+ printf("\n");
+ }
+}
+
+#define IFV if (verbosity > normal)
+
+int do_stream_tests()
+{
+ string fn = "t6.data";
+ int nfails = 0;
+
+ InputByteStream::verbosity(verbosity);
+
+ InputByteStream::setDefaultBufferSize(50);
+ // so we can test skipping over a buffer margin
+
+ try {
+ {
+ struct stat S;
+ if (stat(fn.c_str(), &S) != 0) {
+ // File does not exist
+ int pid = fork();
+ if (pid < 0) {
+ cerr << "Can't fork!" << strerror(errno) << endl;
+ STD::exit(1); // give up immediately
+ } else if (pid == 0) {
+ // child
+ execl("./t6.test",
+ "./t6.test",
+ "-o", fn.c_str(),
+ "-g", "500",
+ NULL);
+ cerr << "Oh-oh: couldn't exec in child of "
+ << getppid() << ": " << strerror(errno) << endl;
+ STD::exit(1);
+ } else {
+ // parent
+ int status;
+ waitpid(pid, &status, 0);
+ cerr << "Generated data file " << fn << endl;
+ }
+ }
+ }
+
+ {
+ int tfails = 0;
+ // Test 1 -- reading without preloading
+ IFV cerr << "===== Stream test 1" << endl;
+ InputByteStream IBS("<osfile>" + fn);
+ tfails += exercise_IBS(IBS);
+ IFV cerr << "Stream test 1 " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ // Test 2 -- FileByteStream, no preloading
+ IFV cerr << "===== Stream test 2" << endl;
+ FileByteStream FBS(fn);
+ tfails += exercise_IBS(FBS);
+ tfails += exercise_FBS(FBS);
+ IFV cerr << "Stream test 2 " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ // Test 3 -- FileByteStream, with preloading
+ IFV cerr << "===== Stream test 3" << endl;
+ FileByteStream FBS(fn, "", true);
+ tfails += exercise_IBS(FBS);
+ tfails += exercise_FBS(FBS);
+ IFV cerr << "Stream test 3 " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ // Test 4 -- with PipeStream
+ IFV cerr << "===== Stream test 4" << endl;
+ PipeStream PBS("./t6.test -g 500");
+ tfails += exercise_IBS(PBS);
+ Byte t = PBS.getByte();
+ if (! (t == 0 && PBS.eof())) {
+ cerr << "Expected PipeStream to be at EOF, but wasn't" << endl;
+ tfails++;
+ }
+ // so subprocess exits normally
+ int status = PBS.getTerminationStatus();
+ IFV cerr << "Test 4: " << report_on_status(status) << endl;
+ if (status != 0) {
+ cerr << "Pipe status non zero [t4], was "
+ << status << endl;
+ tfails++;
+ }
+ IFV cerr << "Stream test 4 " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ // Test 5 -- with PipeStream, but not reading all of stream
+ IFV cerr << "===== Stream test 5" << endl;
+ // Generate lots of data into the pipe. This is more than
+ // our bufferful, and _also_ more than PIPE_BUF (or
+ // pathconf(?,_PC_PIPE_BUF), rather) (presumably). This
+ // means that the getTerminationStatus below `prematurely'
+ // closes the stream, so that the subprocess writes to the
+ // now-closed pipe, and so receives SIGPIPE. Except that
+ // it doesn't, on Solaris, everything behaves nicely and we
+ // get a normal success termination status. I don't think
+ // it's terribly important, really, so right now I've simply
+ // commented out the test. This means that this `test' is in
+ // fact testing nothing, because it cannot increment tfails
+ // in any way. All we're really testing here is whether this
+ // crashes horribly, somehow....
+ PipeStream PBS("./t6.test -g 1000000");
+ Byte b;
+ for (int i=0; i<10; i++)
+ b = PBS.getByte();
+ int status = PBS.getTerminationStatus();
+ IFV cerr << "Test 5: " << report_on_status(status) << endl;
+ if (! WIFSIGNALED(status)) {
+ cerr << "Pipe process terminated normally! Odd..." << endl;
+ // tfails++;
+ }
+ IFV cerr << "Stream test 5 " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ IFV cerr << "===== Stream test 6" << endl;
+ // Test reading from a named pipe. Thus opened as a file,
+ // but not seekable. Pipe name starts with "temp", so
+ // it's cleared up with make clean
+#define PIPE_NAME "./temp-t6.pipe"
+ bool made_fifo;
+ if (mkfifo(PIPE_NAME, 0644) == 0) {
+ made_fifo = true;
+ } else {
+ if (errno == EEXIST) {
+ // A file of that name already exists, probably
+ // from an earlier (failed?) run of this test.
+ // Presume that is the case in fact, and don't
+ // cause a spurious error here.
+ cerr << "FIFO " << PIPE_NAME
+ << " already exists -- reusing" << endl;
+ made_fifo = true;
+ } else {
+ string errmsg = strerror(errno);
+ cerr << "Can't create FIFO: " << errmsg << endl;
+ tfails++;
+ made_fifo = false;
+ }
+ }
+
+ if (made_fifo) {
+ int pid = fork();
+ if (pid < 0) {
+ cerr << "Can't fork!" << strerror(errno) << endl;
+ tfails++;
+ } else if (pid == 0) {
+ // child
+ execl("./t6.test",
+ "./t6.test",
+ "-o", PIPE_NAME,
+ "-g", "500",
+ NULL);
+ cerr << "Oh-oh: couldn't exec in child of "
+ << getppid() << ": " << strerror(errno) << endl;
+ STD::exit(1);
+ } else {
+ // parent
+ InputByteStream IBS(PIPE_NAME);
+ tfails += exercise_IBS(IBS);
+ IBS.close();
+ int status;
+ waitpid(pid, &status, 0);
+ IFV cerr << "Stream test 6: child status="
+ << status << endl;
+ }
+ if (unlink(PIPE_NAME) == -1) {
+ cerr << "Can't unlink pipe " << PIPE_NAME << endl;
+ // but don't fail
+ }
+ }
+ IFV cerr << "Stream test 6 " << (tfails==0?"OK":"FAILED") << endl;
+ nfails += tfails;
+ }
+
+ } catch (DviError& e) {
+ cerr << "DviError: " << e.problem() << endl;
+ nfails++;
+ }
+
+ return nfails;
+}
+
+#if HAVE_SETENV && !HAVE_DECL_SETENV
+extern "C" int setenv(const char* name, const char *value, int overwrite);
+#endif
+#if HAVE_PUTENV && !HAVE_DECL_PUTENV
+extern "C" int putenv(const char* string);
+#endif
+
+int do_pipe_tests()
+{
+ struct {
+ string testcase;
+ string envlist;
+ string expected;
+ } pipetests[] = {
+ { "./t6.test -e HOME LOGNAME BOINK ANOTHER",
+ "PATH=. LOGNAME=blarfl TERM=nothing LOGNAME=norman BOINK=whee",
+ "HOME=!LOGNAME=norman!BOINK=whee!ANOTHER=!"
+ },
+ { "./t6.test -e HOME LOGNAME",
+ "+ HOME=/root LOGNAME=",
+ "HOME=/root!LOGNAME=!"
+ },
+ { "/bin/ls t6.cc", "", "t6.cc", },
+ { "ls t6.cc", "", "", }, // no path
+ { "squorrocks", "", "" },
+ };
+ int npipetests = sizeof(pipetests)/sizeof(pipetests[0]);
+
+ int nfails = 0;
+ int i;
+
+ for (i=0; i<npipetests; i++) {
+ int tfails = 0;
+ try {
+ string ret;
+ PipeStream *PS;
+ IFV cerr << "===== Pipe test " << i << endl;
+ if (pipetests[i].envlist.length() == 0)
+ PS = new PipeStream(pipetests[i].testcase);
+ else
+ PS = new PipeStream(pipetests[i].testcase, pipetests[i].envlist);
+ ret = PS->getResult();
+ int stat = PS->getTerminationStatus();
+ IFV cerr << "Test " << i << " status: "
+ << report_on_status(stat) << endl;
+ if (pipetests[i].expected.length() == 0) {
+ // this command was expected to fail
+ //if (ret.length() != 0) {
+ if (stat == 0) {
+ // ...but didn't
+ tfails++;
+ cerr << "Test " << i
+ << " did not fail as expected, returned <"
+ << ret << ">" << endl;
+ }
+ } else if (ret != pipetests[i].expected) {
+ cerr << "Test " << i
+ << ": expected <" << pipetests[i].expected
+ << ">, got <" << ret << "> (status=" << stat << ")"
+ << endl;
+ tfails++;
+ }
+ delete PS;
+ } catch (DviError& e) {
+ cerr << "Caught exception " << e.problem() << endl;
+ tfails++;
+ }
+ IFV cerr << "Pipe test " << i
+ << (tfails==0 ? " OK" : " FAILED") << endl;
+ nfails += tfails;
+ }
+
+ {
+ int tfails = 0;
+ IFV cerr << "===== Pipe test envs" << endl;
+
+ try {
+ string cmd = "./t6.test -e LOGNAME HOME T TT";
+#if HAVE_SETENV
+ setenv("TT", "test", 1);
+#elif HAVE_PUTENV
+ putenv((char*)"TT=test");
+#else
+# error "Can't set environment variables"
+#endif
+ /*
+#if defined(HAVE_SETENV) && HAVE_DECL_SETENV
+ setenv("TT", "test", 1);
+#elif defined(HAVE_PUTENV) && HAVE_DECL_PUTENV
+ putenv((char*)"TT=test");
+#elif defined(HAVE_SETENV)
+ int setenv(const char* name, const char *value, int overwrite);
+ setenv("TT", "test", 1);
+#elif defined(HAVE_PUTENV)
+ int putenv(const char* string);
+ putenv((char*)"TT=test");
+#else
+#error "Can't set environment variables"
+#endif
+ */
+ string envs = "LOGNAME=blarfl HOME=blarfl T=t + LOGNAME=you TT + LOGNAME=me";
+ string expected = "LOGNAME=me!HOME=";
+ char* h = getenv("HOME");
+ expected += (h != 0 ? h : "");
+ expected += "!T=t!TT=test!";
+ PipeStream *PS = new PipeStream(cmd, envs);
+ string res = PS->getResult();
+ int status = PS->getTerminationStatus();
+ if (status != 0) {
+ tfails++;
+ if (verbosity > normal)
+ cerr << "end: got non-zero status " << status << endl;
+ }
+ if (res != expected) {
+ tfails++;
+ if (verbosity > normal)
+ cerr << "end: expected <" << expected
+ << ", got <" << res << ">" << endl;
+ }
+ delete PS;
+ } catch (DviError& e) {
+ if (verbosity > normal)
+ cerr << "Caught exception " << e.problem() << endl;
+ tfails++;
+ }
+ IFV cerr << "Pipe test envs " << (tfails==0 ? "OK" : "FAILED") << endl;
+ nfails += tfails;
+ }
+
+ return nfails;
+}
+
+
+int main (int argc, char **argv)
+{
+ string teststring;
+
+ progname = argv[0];
+
+ int totalfails = 0;
+
+ int action = 0;
+#define GENERATE 1
+#define ECHOENVS 2
+
+ FILE *output = stdout;
+
+ for (argc--, argv++; argc>0; argc--, argv++) {
+ if (**argv == '-') {
+ switch (*++*argv) {
+ case 'v':
+ verbosity = debug;
+ break;
+
+ case 'e':
+ action = ECHOENVS;
+ break;
+
+ case 'g':
+ action = GENERATE;
+ break;
+
+ case 'o':
+ ++*argv;
+ if (**argv == '\0') {
+ argc--;
+ argv++;
+ }
+ if (argc == 0 || **argv == '-' || **argv == '\0')
+ Usage();
+ if ((output = fopen(*argv, "w")) == 0) {
+ fprintf(stderr, "Can't open file %s to write\n", *argv);
+ STD::exit (1);
+ }
+ // Sleep for a moment, in case the output file is a
+ // FIFO (that is, we are being called by the code
+ // below to write into a pipe), and in case our parent
+ // hasn't opened the pipe, yet. This isn't the proper
+ // solution, since we should be catching SIGPIPE in
+ // generate_data below, but it'll do for the moment.
+ sleep(1);
+ break;
+
+ default:
+ Usage();
+ break;
+ }
+
+ } else {
+ break;
+ }
+ }
+
+ switch (action) {
+ case 0:
+ totalfails += do_stream_tests();
+ totalfails += do_pipe_tests();
+ break;
+
+ case GENERATE:
+ {
+ if (argc == 0)
+ Usage();
+ int n = STD::strtol(*argv, 0, 10);
+ if (n <= 0)
+ Usage();
+ generate_data(n, output);
+ break;
+ }
+
+ case ECHOENVS:
+ echo_envvars(argc, argv);
+ cout << "Don't see this!" << endl;
+ break;
+
+ default:
+ Usage();
+ break;
+ }
+
+ if (verbosity > normal)
+ cerr << "Total fails: " << totalfails << endl;
+
+ STD::exit (totalfails);
+}
+
+void Usage(void)
+{
+ cerr << "Usage: " << progname << " [-o output] [-g num] [-e var...]"
+ << endl;
+ STD::exit (1);
+}
+
diff --git a/dviware/dvi2bitmap/test/t7.cc b/dviware/dvi2bitmap/test/t7.cc
new file mode 100644
index 0000000000..c853786f9c
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t7.cc
@@ -0,0 +1,218 @@
+// Testing DviFile
+
+// This tests only a small subset of the things that could be tested here.
+
+#include <config.h>
+
+#include <DviFile.h>
+
+#include <iostream>
+#include <cstdlib>
+
+#if HAVE_CSTD_INCLUDE
+#include <cmath>
+#else
+#include <math.h>
+#endif
+
+using STD::cerr;
+using STD::endl;
+using STD::fabs;
+
+// could do with boosting accuracy, but that would involve being
+// cleverer in convertUnits
+#define EQTOL(a,b) (fabs((a)/(b)-1)<2e-5)
+
+int testConvertFromScaledPoints(void)
+{
+ struct {
+ int testvalue;
+ double expected;
+ DviFile::DviUnits unit;
+ const char* unitname;
+ } testset[] = {
+ { 12345, 12345, DviFile::unit_sp, "sp", },
+ { 65536, 1, DviFile::unit_pt, "pt", },
+ { 65536*12, 1, DviFile::unit_pc, "pc", },
+ { 65536*7227, 7200, DviFile::unit_bp, "bp", },
+ { 65536*7227, 100, DviFile::unit_in, "in", },
+ { 65536*7227, 2540, DviFile::unit_mm, "mm", },
+ { 65536*7227, 254, DviFile::unit_cm, "cm", },
+ { 65536*1238, 1157, DviFile::unit_dd, "dd", },
+ { 65536*1238*12, 1157, DviFile::unit_cc, "cc", },
+ };
+ int ntests = sizeof(testset)/sizeof(testset[0]);
+
+ int nerrors = 0;
+
+ for (int i=0; i<ntests; i++) {
+ double tvalue = DviFile::convertFromScaledPoints(testset[i].testvalue,
+ testset[i].unit);
+
+ if (! EQTOL(tvalue, testset[i].expected)) {
+ cerr << "Converting: " << testset[i].testvalue
+ << "sp = " << tvalue << testset[i].unitname
+ << ", expected "
+ << testset[i].expected << testset[i].unitname
+ << endl;
+ nerrors++;
+ }
+ }
+
+ return nerrors;
+}
+
+int testConvertToScaledPoints(void)
+{
+ struct {
+ int testvalue;
+ double expected;
+ DviFile::DviUnits unit;
+ const char* unitname;
+ } testset[] = {
+ // Same tests as above
+ { 12345, 12345, DviFile::unit_sp, "sp", },
+ { 1, 65536, DviFile::unit_pt, "pt", },
+ { 1, 65536*12, DviFile::unit_pc, "pc", },
+ { 7200, 65536*7227, DviFile::unit_bp, "bp", },
+ { 100, 65536*7227, DviFile::unit_in, "in", },
+ { 2540, 65536*7227, DviFile::unit_mm, "mm", },
+ { 254, 65536*7227, DviFile::unit_cm, "cm", },
+ { 1157, 65536*1238, DviFile::unit_dd, "dd", },
+ { 1157, 65536*1238*12, DviFile::unit_cc, "cc", },
+ };
+ int ntests = sizeof(testset)/sizeof(testset[0]);
+
+ int nerrors = 0;
+
+ for (int i=0; i<ntests; i++) {
+ double tvalue = DviFile::convertToScaledPoints(testset[i].testvalue,
+ testset[i].unit);
+
+ if (! EQTOL(tvalue, testset[i].expected)) {
+ cerr << "Converting: "
+ << testset[i].testvalue << testset[i].unitname
+ << " = "
+ << tvalue
+ << "sp, expected "
+ << testset[i].expected << "sp"
+ << " (diff=" << tvalue-testset[i].expected << ")"
+ << endl;
+ nerrors++;
+ }
+ }
+
+ return nerrors;
+}
+
+int testConvertUnits(void)
+{
+#define CONV(f,fu, t,tu) \
+ { f, t, DviFile::unit_ ## fu, #fu, DviFile::unit_ ## tu, #tu, }
+
+ struct {
+ int testvalue;
+ double expected;
+ DviFile::DviUnits from_unit;
+ const char* from_unitname;
+ DviFile::DviUnits to_unit;
+ const char* to_unitname;
+ } testset[] = {
+ CONV(12345, sp, 12345, sp),
+ CONV(1, pt, 65536, sp),
+ CONV(1, in, 72.27, pt),
+ CONV(10, in, 254, mm),
+ CONV(254, mm, 10, in),
+ };
+#undef CONV
+ int ntests = sizeof(testset)/sizeof(testset[0]);
+
+ int nerrors = 0;
+
+ for (int i=0; i<ntests; i++) {
+ double tvalue = DviFile::convertUnits(testset[i].testvalue,
+ testset[i].from_unit,
+ testset[i].to_unit);
+
+ if (! EQTOL(tvalue,testset[i].expected)) {
+ cerr << "Converting: "
+ << testset[i].testvalue << testset[i].from_unitname
+ << " = "
+ << tvalue << testset[i].to_unitname
+ << ", expected "
+ << testset[i].expected << testset[i].to_unitname
+ << " (diff=" << tvalue-testset[i].expected << ")"
+ << endl;
+ nerrors++;
+ }
+ }
+
+ return nerrors;
+}
+
+int testDviFile()
+{
+ string fn = "t5.dvi";
+ DviFile *dvif = new DviFile(fn);
+ DviFilePreamble *p = dynamic_cast<DviFilePreamble*>(dvif->getEvent());
+
+ if (! p) {
+ cerr << "Eeek! First event from DVI file is not DviFilePreamble"
+ << endl;
+ return 1; // JUMP OUT
+ }
+
+ int nerrors = 0;
+
+ struct {
+ double testvalue; // in points
+ double expected_sp;
+ double expected_px;
+ } testset[] = {
+ { 72.27, 65536*72.27, 110 },
+ };
+ int ntests = sizeof(testset)/sizeof(testset[0]);
+
+ for (int i=0; i<ntests; i++) {
+ double tvalue_sp = DviFile::convertUnits(testset[i].testvalue,
+ DviFile::unit_pt,
+ DviFile::unit_sp,
+ dvif);
+ double tvalue_px = DviFile::convertUnits(testset[i].testvalue,
+ DviFile::unit_pt,
+ DviFile::unit_pixels,
+ dvif);
+ if (! (EQTOL(tvalue_sp,testset[i].expected_sp)
+ && EQTOL(tvalue_px,testset[i].expected_px))) {
+ cerr << "Converting "
+ << testset[i].testvalue << "pt: got "
+ << tvalue_sp << "sp," << tvalue_px << "px, expected "
+ << testset[i].expected_sp << "sp,"
+ << testset[i].expected_px << "px (diff="
+ << tvalue_sp - testset[i].expected_sp
+ << ","
+ << tvalue_px - testset[i].expected_px
+ << ")" << endl;
+ nerrors++;
+ }
+ }
+ return nerrors;
+}
+
+
+int main(int argc, char** argv)
+{
+ int nerrors = 0;
+
+ try {
+ nerrors += testConvertFromScaledPoints();
+ nerrors += testConvertToScaledPoints();
+ nerrors += testConvertUnits();
+ nerrors += testDviFile();
+ } catch (DviError &e) {
+ cerr << "Test threw DviError: " << e.problem() << endl;
+ }
+
+ STD::exit(nerrors);
+}
+
diff --git a/dviware/dvi2bitmap/test/t8.pl b/dviware/dvi2bitmap/test/t8.pl
new file mode 100755
index 0000000000..cb9e93d4e2
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t8.pl
@@ -0,0 +1,195 @@
+#! /usr/bin/perl -w
+#
+# Testing dvi2bitmap specials
+#
+# Create a TeX file with strut and mark specials in it, use
+# --query=bitmaps, and check that the correct stuff is reported.
+
+sub compare_bitmaps($$\@);
+
+$texbin='/usr/texbin/tex';
+if ($texbin eq 'NO_TEX') {
+ print STDERR "No TeX binary available. Can't run t8, so assume success\n";
+ exit 0;
+}
+
+$prefix = 'temp-t8';
+$texfile = "$prefix.tex";
+$m = 2; # magnification factor
+
+open (TEX, ">$texfile") || die "Can't open $texfile for output";
+$newpage = "\n\n\\vfill\\eject\n\n";
+
+$nerrors = 0;
+
+@expected = ();
+
+print TEX <<'EOD';
+%\hoffset=0pt
+%\voffset=0pt
+%\leftskip=0pt % default
+%\topskip=0pt
+%\parindent=0pt
+%\parskip=0pt
+\nopagenumbers
+
+
+EOD
+
+print TEX "\\special{dvi2bitmap default unit bp}\n\n";
+
+print TEX '\vrule width 20bp height 10bp';
+print TEX $newpage;
+push(@expected, [20*$m, 10*$m]);
+
+
+print TEX '\vrule width 20bp height 10bp \special{dvi2bitmap strut 10 4 5 6}';
+print TEX $newpage;
+push(@expected, [24*$m, 16*$m]);
+
+print TEX '\vrule width 10bp height 10bp \special{dvi2bitmap strut 12 0 15 0}';
+print TEX $newpage;
+push(@expected, [12*$m, 15*$m]);
+
+print TEX '\vrule width 20bp height 10bp \special{dvi2bitmap mark}';
+print TEX $newpage;
+push(@expected, [20*$m, 10*$m, 20*$m, 10*$m]);
+
+print TEX "\\bye\n";
+
+close(TEX);
+
+system("$texbin $prefix") == 0
+ || die "Command 'tex $prefix' failed";
+
+########## test 1
+#
+# Basic use
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 1", $cmd, @expected);
+
+
+########## test 2
+#
+# Same, but with a --magnification of 2, so that the expected values
+# must be doubled
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*2);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=2 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 2", $cmd, @texpected);
+
+########## test 3
+#
+# Same, but with a --magnification of 5, so that the expected values
+# must be multiplied by 5. This should show up more straightforward
+# rounding errors
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*5);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=5 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 3", $cmd, @texpected);
+
+########## test 4
+#
+# Same, but with a --magnification of 3 and --scaledown of 2. This
+# seems to stress roundings. In DviFilePosition::DviFilePosition, the
+# initialised positions are offset by one to avoid a failure here (and
+# are otherwise unmotivated). [there's a reference to this text there,
+# so change both together]
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*1.5);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=3 --scaledown=2 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 4", $cmd, @texpected);
+
+########## That's all....
+
+
+exit($nerrors);
+
+
+sub compare_bitmaps ($$\@) {
+ my $testlabel = shift;
+ my $cmd = shift;
+ my $exref = shift;
+ my $nerr = 0;
+
+ my @exp = @$exref;
+
+ open (DB, "$cmd |") || die "Can't open $cmd in a pipe";
+
+ my $ntests = 0;
+ while (<DB>) {
+ chomp;
+ s/^Qbitmaps \S*\s*//;
+ my @a = split;
+
+ if ($#expected < 0) {
+ print STDERR "More actual than expected\n";
+ $nerr++;
+ last;
+ }
+ my @e = @{$exp[$ntests]};
+ $ntests++;
+
+ my $isok = 1;
+ my $i = 0;
+ while (1) {
+ if (! (defined($e[$i]) && defined($a[$i]))) { # one list has ended
+ $isok = !(defined($e[$i]) || defined($a[$i]));
+ # false unless both undef
+ last;
+ }
+ if ($e[$i] != $a[$i]) {
+ $isok = 0;
+ last;
+ }
+ $i++;
+ }
+ if (!$isok) {
+ print STDERR "$testlabel, page $ntests: expected [";
+ foreach $i (0..$#e) {
+ printf STDERR " %.1f", $e[$i];
+ }
+ print STDERR " ], got [";
+ foreach $i (0..$#a) {
+ printf STDERR " %.1f", $a[$i];
+ }
+ print " ]\n";
+ $nerr++;
+ }
+ }
+
+ close(DB);
+
+ return $nerr;
+}
+
+
diff --git a/dviware/dvi2bitmap/test/t8.pl.in b/dviware/dvi2bitmap/test/t8.pl.in
new file mode 100755
index 0000000000..85519e3519
--- /dev/null
+++ b/dviware/dvi2bitmap/test/t8.pl.in
@@ -0,0 +1,195 @@
+#! /usr/bin/perl -w
+#
+# Testing dvi2bitmap specials
+#
+# Create a TeX file with strut and mark specials in it, use
+# --query=bitmaps, and check that the correct stuff is reported.
+
+sub compare_bitmaps($$\@);
+
+$texbin='@TEX@';
+if ($texbin eq 'NO_TEX') {
+ print STDERR "No TeX binary available. Can't run t8, so assume success\n";
+ exit 0;
+}
+
+$prefix = 'temp-t8';
+$texfile = "$prefix.tex";
+$m = 2; # magnification factor
+
+open (TEX, ">$texfile") || die "Can't open $texfile for output";
+$newpage = "\n\n\\vfill\\eject\n\n";
+
+$nerrors = 0;
+
+@expected = ();
+
+print TEX <<'EOD';
+%\hoffset=0pt
+%\voffset=0pt
+%\leftskip=0pt % default
+%\topskip=0pt
+%\parindent=0pt
+%\parskip=0pt
+\nopagenumbers
+
+
+EOD
+
+print TEX "\\special{dvi2bitmap default unit bp}\n\n";
+
+print TEX '\vrule width 20bp height 10bp';
+print TEX $newpage;
+push(@expected, [20*$m, 10*$m]);
+
+
+print TEX '\vrule width 20bp height 10bp \special{dvi2bitmap strut 10 4 5 6}';
+print TEX $newpage;
+push(@expected, [24*$m, 16*$m]);
+
+print TEX '\vrule width 10bp height 10bp \special{dvi2bitmap strut 12 0 15 0}';
+print TEX $newpage;
+push(@expected, [12*$m, 15*$m]);
+
+print TEX '\vrule width 20bp height 10bp \special{dvi2bitmap mark}';
+print TEX $newpage;
+push(@expected, [20*$m, 10*$m, 20*$m, 10*$m]);
+
+print TEX "\\bye\n";
+
+close(TEX);
+
+system("$texbin $prefix") == 0
+ || die "Command 'tex $prefix' failed";
+
+########## test 1
+#
+# Basic use
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 1", $cmd, @expected);
+
+
+########## test 2
+#
+# Same, but with a --magnification of 2, so that the expected values
+# must be doubled
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*2);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=2 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 2", $cmd, @texpected);
+
+########## test 3
+#
+# Same, but with a --magnification of 5, so that the expected values
+# must be multiplied by 5. This should show up more straightforward
+# rounding errors
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*5);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=5 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 3", $cmd, @texpected);
+
+########## test 4
+#
+# Same, but with a --magnification of 3 and --scaledown of 2. This
+# seems to stress roundings. In DviFilePosition::DviFilePosition, the
+# initialised positions are offset by one to avoid a failure here (and
+# are otherwise unmotivated). [there's a reference to this text there,
+# so change both together]
+
+@texpected = ();
+foreach my $ev (@expected) {
+ my @t = ();
+ foreach my $tt (@$ev) {
+ push (@t, $tt*1.5);
+ }
+ push (@texpected, \@t);
+}
+
+$cmd = sprintf("../dvi2bitmap --output=%s-%%d --query=bitmaps --resolution=%d --verbose=quiet --magnification=3 --scaledown=2 %s.dvi",
+ $prefix, 72*$m, $prefix);
+$nerrors += compare_bitmaps("Test 4", $cmd, @texpected);
+
+########## That's all....
+
+
+exit($nerrors);
+
+
+sub compare_bitmaps ($$\@) {
+ my $testlabel = shift;
+ my $cmd = shift;
+ my $exref = shift;
+ my $nerr = 0;
+
+ my @exp = @$exref;
+
+ open (DB, "$cmd |") || die "Can't open $cmd in a pipe";
+
+ my $ntests = 0;
+ while (<DB>) {
+ chomp;
+ s/^Qbitmaps \S*\s*//;
+ my @a = split;
+
+ if ($#expected < 0) {
+ print STDERR "More actual than expected\n";
+ $nerr++;
+ last;
+ }
+ my @e = @{$exp[$ntests]};
+ $ntests++;
+
+ my $isok = 1;
+ my $i = 0;
+ while (1) {
+ if (! (defined($e[$i]) && defined($a[$i]))) { # one list has ended
+ $isok = !(defined($e[$i]) || defined($a[$i]));
+ # false unless both undef
+ last;
+ }
+ if ($e[$i] != $a[$i]) {
+ $isok = 0;
+ last;
+ }
+ $i++;
+ }
+ if (!$isok) {
+ print STDERR "$testlabel, page $ntests: expected [";
+ foreach $i (0..$#e) {
+ printf STDERR " %.1f", $e[$i];
+ }
+ print STDERR " ], got [";
+ foreach $i (0..$#a) {
+ printf STDERR " %.1f", $a[$i];
+ }
+ print " ]\n";
+ $nerr++;
+ }
+ }
+
+ close(DB);
+
+ return $nerr;
+}
+
+