83 lines
1.5 KiB
Plaintext
Executable File
83 lines
1.5 KiB
Plaintext
Executable File
echo T.int-expr: test interval expressions
|
|
|
|
awk=${awk-../a.out}
|
|
|
|
rm -f foo
|
|
|
|
cat << \EOF > prog
|
|
NF == 0 { next }
|
|
$1 == "pat" { pattern = $2; next }
|
|
{
|
|
check = ($1 ~ pattern)
|
|
printf("%s ~ /%s/ -> should be %d, is %d\n", $1, pattern, $2, check)
|
|
}
|
|
EOF
|
|
|
|
cat << \EOF > foo.in
|
|
pat ab{0}c
|
|
ac 1
|
|
abc 0
|
|
|
|
pat ab{1}c
|
|
ac 0
|
|
abc 1
|
|
abbc 0
|
|
|
|
pat ab{1,}c
|
|
ac 0
|
|
abc 1
|
|
abbc 1
|
|
abbbc 1
|
|
abbbbc 1
|
|
|
|
pat ab{0,1}c
|
|
ac 1
|
|
abc 1
|
|
abbc 0
|
|
|
|
pat ab{0,3}c
|
|
ac 1
|
|
abc 1
|
|
abbc 1
|
|
abbbc 1
|
|
abbbbc 0
|
|
|
|
pat ab{1,3}c
|
|
ac 0
|
|
abc 1
|
|
abbc 1
|
|
abbbc 1
|
|
abbbbc 0
|
|
EOF
|
|
|
|
cat << \EOF > foo1
|
|
ac ~ /ab{0}c/ -> should be 1, is 1
|
|
abc ~ /ab{0}c/ -> should be 0, is 0
|
|
ac ~ /ab{1}c/ -> should be 0, is 0
|
|
abc ~ /ab{1}c/ -> should be 1, is 1
|
|
abbc ~ /ab{1}c/ -> should be 0, is 0
|
|
ac ~ /ab{1,}c/ -> should be 0, is 0
|
|
abc ~ /ab{1,}c/ -> should be 1, is 1
|
|
abbc ~ /ab{1,}c/ -> should be 1, is 1
|
|
abbbc ~ /ab{1,}c/ -> should be 1, is 1
|
|
abbbbc ~ /ab{1,}c/ -> should be 1, is 1
|
|
ac ~ /ab{0,1}c/ -> should be 1, is 1
|
|
abc ~ /ab{0,1}c/ -> should be 1, is 1
|
|
abbc ~ /ab{0,1}c/ -> should be 0, is 0
|
|
ac ~ /ab{0,3}c/ -> should be 1, is 1
|
|
abc ~ /ab{0,3}c/ -> should be 1, is 1
|
|
abbc ~ /ab{0,3}c/ -> should be 1, is 1
|
|
abbbc ~ /ab{0,3}c/ -> should be 1, is 1
|
|
abbbbc ~ /ab{0,3}c/ -> should be 0, is 0
|
|
ac ~ /ab{1,3}c/ -> should be 0, is 0
|
|
abc ~ /ab{1,3}c/ -> should be 1, is 1
|
|
abbc ~ /ab{1,3}c/ -> should be 1, is 1
|
|
abbbc ~ /ab{1,3}c/ -> should be 1, is 1
|
|
abbbbc ~ /ab{1,3}c/ -> should be 0, is 0
|
|
EOF
|
|
|
|
|
|
$awk -f prog foo.in > foo2
|
|
diff foo1 foo2 || echo 'BAD: T.int-expr (1)'
|
|
rm -f prog
|