summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2013-07-22 11:49:06 +0200
committerDenys Vlasenko2013-07-22 11:49:06 +0200
commitb855460adcda8dfb18ac36755f128ce32088ae87 (patch)
tree6be4466649292e27d560abfd637a978c92c40ad9
parentb0e9b72915a87121aabf21d4e382e16e0a9a5175 (diff)
downloadbusybox-b855460adcda8dfb18ac36755f128ce32088ae87.zip
busybox-b855460adcda8dfb18ac36755f128ce32088ae87.tar.gz
awk.tests: add test for recent large integer fix
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rwxr-xr-xtestsuite/awk.tests11
1 files changed, 8 insertions, 3 deletions
diff --git a/testsuite/awk.tests b/testsuite/awk.tests
index dad49c3..160f460 100755
--- a/testsuite/awk.tests
+++ b/testsuite/awk.tests
@@ -24,7 +24,7 @@ testing "awk if operator < " "awk 'BEGIN{if(2 < 13) print \"foo\"}'" "foo\n" "
testing "awk if string == " "awk 'BEGIN{if(\"a\"==\"ab\") print \"bar\"}'" "" "" ""
# 4294967295 = 0xffffffff
-testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
+testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4294967295\n" "" "\n"
# we were testing for a non-empty body when deciding if a function was
# defined or not. The testcase below caused:
@@ -45,8 +45,8 @@ testing "awk handles empty function f(arg){}" \
"" ""
optional DESKTOP
-testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4.29497e+09\n" "" "\n"
-testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2.14748e+09\n" "" "\n"
+testing "awk hex const 1" "awk '{ print or(0xffffffff,1) }'" "4294967295\n" "" "\n"
+testing "awk hex const 2" "awk '{ print or(0x80000000,1) }'" "2147483649\n" "" "\n"
testing "awk oct const" "awk '{ print or(01234,1) }'" "669\n" "" "\n"
SKIP=
@@ -241,6 +241,11 @@ testing "awk FS assignment" "awk '{FS=\":\"; print \$1}'" \
"" \
"a:b c:d\ne:f g:h"
+testing "awk large integer" \
+ "awk 'BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}'" \
+ "2147483647 2147483647 0 2147483648 2147483648 0\n" \
+ "" ""
+
# testing "description" "command" "result" "infile" "stdin"
exit $FAILCOUNT