1 | #!/bin/sh
|
---|
2 |
|
---|
3 | # Test runner for the binary-operation version of dc.sed.
|
---|
4 | # Adapted from old-style 'binary.sed' test.
|
---|
5 |
|
---|
6 | # Copyright (C) 2017-2022 Free Software Foundation, Inc.
|
---|
7 |
|
---|
8 | # This program is free software: you can redistribute it and/or modify
|
---|
9 | # it under the terms of the GNU General Public License as published by
|
---|
10 | # the Free Software Foundation, either version 3 of the License, or
|
---|
11 | # (at your option) any later version.
|
---|
12 |
|
---|
13 | # This program is distributed in the hope that it will be useful,
|
---|
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
16 | # GNU General Public License for more details.
|
---|
17 |
|
---|
18 | # You should have received a copy of the GNU General Public License
|
---|
19 | # along with this program. If not, see <https://www.gnu.org/licenses/>.
|
---|
20 | . "${srcdir=.}/testsuite/init.sh"; path_prepend_ ./sed
|
---|
21 | print_ver_ sed
|
---|
22 |
|
---|
23 | cat << \EOF > inp || framework_failure_
|
---|
24 | 192.168.1.2 br b8<r b16<r b24< R|R|R| D
|
---|
25 | 255.255.255.0 br b8<r b16<r b24< R|R|R| D~r
|
---|
26 | & DDD 24>dpP 16>11111111& dpP 8>11111111& dpP 11111111& dpP
|
---|
27 | | DDD 24>dpP 16>11111111& dpP 8>11111111& dpP 11111111& dpP
|
---|
28 | EOF
|
---|
29 |
|
---|
30 |
|
---|
31 | cat << \EOF > exp || framework_failure_
|
---|
32 | 192
|
---|
33 | 168
|
---|
34 | 1
|
---|
35 | 0
|
---|
36 | 192
|
---|
37 | 168
|
---|
38 | 1
|
---|
39 | 255
|
---|
40 | EOF
|
---|
41 |
|
---|
42 |
|
---|
43 | # location of the external SED scripts
|
---|
44 | dir="$abs_top_srcdir/testsuite"
|
---|
45 |
|
---|
46 |
|
---|
47 | # Run the three variations of the sed script
|
---|
48 | sed -n -f "$dir/binary.sed" < inp > out1 || fail=1
|
---|
49 | remove_cr_inplace out1
|
---|
50 | compare exp out1 || fail=1
|
---|
51 |
|
---|
52 | sed -n -f "$dir/binary2.sed" < inp > out2 || fail=1
|
---|
53 | remove_cr_inplace out2
|
---|
54 | compare exp out2 || fail=1
|
---|
55 |
|
---|
56 | sed -n -f "$dir/binary3.sed" < inp > out3 || fail=1
|
---|
57 | remove_cr_inplace out3
|
---|
58 | compare exp out3 || fail=1
|
---|
59 |
|
---|
60 |
|
---|
61 | Exit $fail
|
---|