aboutsummaryrefslogtreecommitdiffstats
path: root/pc/testoutcmp.awk
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-04-18 23:21:26 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-04-18 23:21:26 +0300
commitb902be41919a9b13c915cda67446c58f16f39b41 (patch)
treee8d07a871e18a2b4179616a1794310b71ee50939 /pc/testoutcmp.awk
parentbdc8a5dcf17bae4d1207de725ecf84dfaa637b5a (diff)
parent114f39dd4a1b6da85feb34eb1452811a5e3f6728 (diff)
downloadegawk-b902be41919a9b13c915cda67446c58f16f39b41.tar.gz
egawk-b902be41919a9b13c915cda67446c58f16f39b41.tar.bz2
egawk-b902be41919a9b13c915cda67446c58f16f39b41.zip
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'pc/testoutcmp.awk')
-rw-r--r--pc/testoutcmp.awk35
1 files changed, 29 insertions, 6 deletions
diff --git a/pc/testoutcmp.awk b/pc/testoutcmp.awk
index 33dcaa3f..d4bbadd0 100644
--- a/pc/testoutcmp.awk
+++ b/pc/testoutcmp.awk
@@ -1,7 +1,8 @@
# cmp replacement program for PC where the error messages aren't
-# exactly the same. should run even on old awk
+# exactly the same, and neither are e+NNN exponents.
+# should run even on old awk
#
-# Copyright (C) 2011 the Free Software Foundation, Inc.
+# Copyright (C) 2011-2015 the Free Software Foundation, Inc.
#
# This file is part of GAWK, the GNU implementation of the
# AWK Programming Language.
@@ -35,6 +36,7 @@ END {
exit 1
}
+ status = 0;
for (i = 1; i <= FNR; i++) {
good = lines[0, i]
actual = lines[1, i]
@@ -46,12 +48,33 @@ END {
l--
if (substr(good, 1, l) == substr(actual, 1, l))
continue
+
+ # For exponents
+ actual1 = gensub(/( ?)([-+]?[0-9.][0-9.]?+e[-+])0([0-9][0-9])/, " \\1\\2\\3", "g", actual)
+ if (good == actual1)
+ continue
+ actual1 = gensub(/([-+]?0)([0-9.]+e[-+])0([0-9][0-9])/, "\\10\\2\\3", "g", actual)
+ if (good == actual1)
+ continue
+ actual1 = gensub(/( ?)([-+]?)([1-9.][0-9.]?+e[-+])0([0-9][0-9])/, "\\1\\20\\3\\4", "g", actual)
+ if (good == actual1)
+ continue
+ actual1 = gensub(/([-+]?[0-9.]+e[-+])0([0-9][0-9])/, "\\1\\2 ", "g", actual)
+ if (good == actual1)
+ continue
+ actual1 = gensub(/([-+]?[0-9.]+e[-+])0([0-9][0-9])/, "\\1\\2", "g", actual)
+ if (good == actual1)
+ continue
+ # For exit test
+ actual1 = gensub(/([01]) nul/, "\\1 null", "g", actual)
+ if (good == actual1)
+ continue
else {
- printf("%s and %s are not equal\n", ARGV[1],
- ARGV[2]) > "/dev/stderr"
- exit 1
+ printf("-%s\n", good) > "/dev/stderr"
+ printf("+%s\n", actual) > "/dev/stderr"
+ status = 1
}
}
- exit 0
+ exit status
}