+AT_DATA([num-out-compare.py],
+[[#! /usr/bin/python3
+
+import getopt
+import itertools
+import re
+import sys
+
+def usage():
+ print("""\
+%s: compare expected and actual numeric formatting output
+usage: %s [OPTION...] EXPECTED ACTUAL
+where EXPECTED is the file containing expected output
+and ACTUAL is the file containing actual output.
+Options:
+ -e, --exact: Require numbers to be exactly equal.
+ (By default, small differences are permitted.)
+ -s, --spss: Ignore most SPSS formatting bugs in EXPECTED.
+ (A few differences are not compensated)
+ -v, --verbose: Use once to summarize errors and differences.
+ Use twice for details of differences."""
+ % (sys.argv[0], sys.argv[0]))
+ sys.exit(0)
+
+exact = 0
+spss = 0
+verbose = 0
+
+options, args = getopt.gnu_getopt(sys.argv[1:], 'esvh',
+ ['exact', 'spss', 'verbose', 'help'])
+for key, value in options:
+ if key in ['-e', '--exact']:
+ exact = True
+ elif key in ['-s', '--spss']:
+ spss = True
+ elif key in ['-v', '--verbose']:
+ verbose += 1
+ elif key in ['-h', '--help']:
+ usage()
+ else:
+ assert False
+if len(args) != 2:
+ sys.stderr.write("%s\n" % len(args))
+ sys.stderr.write("exactly two nonoption arguments are required "
+ "(use --help for help)\n")
+ sys.exit(1)
+
+def increment(n):
+ """Returns 'n' incremented by one unit in its final decimal place.
+ """