Debian Codegraph @

utils/axodraw2/axodraw2-src/axohelp-big.test

raw
1 #!/bin/sh -vx
2
3 # Copyright (C) 2018 John Collins (jcc8 at psu dot edu)
4 # You may freely use, modify and/or distribute this file.
5
6 # Prevent errors from sed if it encounters non-UTF-8 strings in utf-8 locale
7 LC_ALL=C; export LC_ALL; LANGUAGE=C; export LANGUAGE
8
9 # Notes about interpretation of tests:
10 # The test file was generated in the compilation of axodraw2's manual,
11 # and this test script therefore verifies much functionality of
12 # axohelp. However, if the test fails, it may not actually indicate
13 # an error. There are two possibilities for spurious failure:
14 # a. There is a mismatch of line endings (\n v. \r\n, etc) between the
15 # generated test file test-big.ax2 and the reference file
16 # test-big.ax2-std. Correct the problem by adjusting
17 # test-big.ax2-std accordingly.
18 # b. Some of the numbers in the output file are generated by complex
19 # floating point computations. Rounding errors can generate small
20 # differences between the generated file and the reference file.
21 # This results, for example, from a 32-bit executable compared with
22 # a 64-bit executable, or from a compilation with different
23 # compilers and the associated libraries (e.g., VisualStudio
24 # compared with gcc).
25 # Interpret the results of the test accordingly.
26
27 if test -z "$test_srcdir"; then
28 # If not set, then we are not running from `make check'.
29 test_srcdir=`echo "$0" | sed -e 's,/[^\\/]*$,,'` # == dirname $0
30 test "$test_srcdir" = "$0" && test_srcdir=. # in case subst failed
31 fi
32
33 test "$test_srcdir" = . \
34 || cp "$test_srcdir"/test-big.ax1 "$test_srcdir"/test-big.ax2-std . \
35 || exit 1
36
37 echo Running axohelp on test document ...
38 ./axohelp test-big \
39 || { echo axohelp failed to run correctly ; exit 1; }
40
41 echo Checking result file test.ax2, after converting line-endings ...
42 tr -d '\r' < test-big.ax2 > tmp.ax2
43 tr -d '\r' < test-big.ax2-std > tmp.ax2-std
44 diff tmp.ax2-std tmp.ax2 \
45 || { echo The .ax2 file created by axohelp was incorrect; exit 1; }
46
47 echo Success, so I will remove generated file test.ax2
48 rm test-big.ax2 tmp.ax2 tmp.ax2-std