2007-07-19 00:03:18 +05:30
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Copyright 2007 by Denys Vlasenko <vda.linux@googlemail.com>
|
|
|
|
# Licensed under GPL v2, see file LICENSE for details.
|
|
|
|
|
|
|
|
. testing.sh
|
|
|
|
|
2008-07-15 12:15:14 +05:30
|
|
|
# testing "description" "command" "result" "infile" "stdin"
|
2007-07-19 00:03:18 +05:30
|
|
|
|
|
|
|
testing "awk -F case 0" "awk -F '[#]' '{ print NF }'" "" "" ""
|
|
|
|
testing "awk -F case 1" "awk -F '[#]' '{ print NF }'" "0\n" "" "\n"
|
|
|
|
testing "awk -F case 2" "awk -F '[#]' '{ print NF }'" "2\n" "" "#\n"
|
|
|
|
testing "awk -F case 3" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#\n"
|
|
|
|
testing "awk -F case 4" "awk -F '[#]' '{ print NF }'" "3\n" "" "#abc#zz\n"
|
|
|
|
testing "awk -F case 5" "awk -F '[#]' '{ print NF }'" "4\n" "" "#abc##zz\n"
|
|
|
|
testing "awk -F case 6" "awk -F '[#]' '{ print NF }'" "4\n" "" "z#abc##zz\n"
|
|
|
|
testing "awk -F case 7" "awk -F '[#]' '{ print NF }'" "5\n" "" "z##abc##zz\n"
|
|
|
|
|
2008-08-29 14:07:07 +05:30
|
|
|
# 4294967295 = 0xffffffff
|
|
|
|
testing "awk bitwise op" "awk '{ print or(4294967295,1) }'" "4.29497e+09\n" "" "\n"
|
|
|
|
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"
|
2008-09-02 14:30:23 +05:30
|
|
|
testing "awk oct const" "awk '{ print or(01234,1) }'" "669\n" "" "\n"
|
2008-08-29 14:07:07 +05:30
|
|
|
|
2008-07-01 07:27:36 +05:30
|
|
|
tar xjf awk_t1.tar.bz2
|
|
|
|
testing "awk 'gcc build bug'" \
|
|
|
|
"awk -f awk_t1_opt-functions.awk -f awk_t1_opth-gen.awk <awk_t1_input | md5sum" \
|
|
|
|
"f842e256461a5ab1ec60b58d16f1114f -\n" \
|
|
|
|
"" ""
|
|
|
|
rm -rf awk_t1_*
|
|
|
|
|
2009-01-25 06:30:15 +05:30
|
|
|
Q='":"'
|
|
|
|
|
|
|
|
testing "awk NF in BEGIN" \
|
|
|
|
"awk 'BEGIN { print ${Q} NF ${Q} \$0 ${Q} \$1 ${Q} \$2 ${Q} }'" \
|
|
|
|
":0::::\n" \
|
|
|
|
"" ""
|
|
|
|
|
2007-07-19 00:03:18 +05:30
|
|
|
exit $FAILCOUNT
|