1#!/bin/bash 2 3[ -f testing.sh ] && . testing.sh 4 5#testing "name" "command" "result" "infile" "stdin" 6 7cat >file1 <<EOF 8some words . 9 10some 11lines 12EOF 13 14testing "wc" "wc >/dev/null && echo yes" "yes\n" "" "" 15testing "empty file" "wc" " 0 0 0\n" "" "" 16testing "standard input" "wc" " 1 3 5\n" "" "a b\nc" 17testing "standard input -c" "wc -c" "5\n" "" "a b\nc" 18testing "standard input -cl" "wc -cl" " 1 5\n" "" "a b\nc" 19testing "-c" "wc -c file1" "26 file1\n" "" "" 20testing "-l" "wc -l file1" "4 file1\n" "" "" 21testing "-w" "wc -w file1" "5 file1\n" "" "" 22testing "one file" "wc file1" "4 5 26 file1\n" "" "" 23testing "multiple files" "wc input - file1" \ 24 " 1 2 3 input\n 0 2 3 -\n 4 5 26 file1\n 5 9 32 total\n" "a\nb" "a b" 25 26#Tests for wc -m 27echo -n " " > file1 28for i in $(seq 1 512); do echo -n "üüüüüüüüüüüüüüüü" >> file1; done 29testing "-m" "wc -m file1" "8193 file1\n" "" "" 30testing "-m 2" 'cat "$FILES/utf8/test2.txt" | wc -m' "169\n" "" "" 31echo -n " " > file1 32testing "-mlw" "wc -mlw input" "1 2 11 input\n" "hello, 世界!\n" "" 33rm file1 34