Add copyright and licence notices to files which lack them.
[pspp] / tests / libpspp / line-reader.at
1 dnl PSPP - a program for statistical analysis.
2 dnl Copyright (C) 2017 Free Software Foundation, Inc.
3 dnl 
4 dnl This program is free software: you can redistribute it and/or modify
5 dnl it under the terms of the GNU General Public License as published by
6 dnl the Free Software Foundation, either version 3 of the License, or
7 dnl (at your option) any later version.
8 dnl 
9 dnl This program is distributed in the hope that it will be useful,
10 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
11 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 dnl GNU General Public License for more details.
13 dnl 
14 dnl You should have received a copy of the GNU General Public License
15 dnl along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 dnl AT_BANNER([line_reader])
17
18 AT_SETUP([read ASCII])
19 AT_KEYWORDS([line_reader])
20 AT_CHECK([i18n-test supports_encodings ASCII])
21 AT_CHECK([echo string | line-reader-test read - ASCII], [0], [dnl
22 encoded in ASCII
23 "string"
24 ])
25 AT_CLEANUP
26
27 AT_SETUP([read UTF-8])
28 AT_KEYWORDS([line_reader])
29 AT_CHECK([printf '\346\227\245\346\234\254\350\252\236\n' | line-reader-test read - UTF-8], [0], [dnl
30 encoded in UTF-8
31 "日本語"
32 ])
33 AT_CLEANUP
34
35 AT_SETUP([read EUC-JP])
36 AT_KEYWORDS([line_reader])
37 AT_CHECK([i18n-test supports_encodings EUC-JP])
38 AT_CHECK([printf '\244\241 \244\242 \244\243 \244\244 \244\245 \244\246 \244\247 \244\250 \244\251 \244\252\n' | line-reader-test read - EUC-JP], [0], [dnl
39 encoded in EUC-JP
40 "ぁ あ ぃ い ぅ う ぇ え ぉ お"
41 ])
42 AT_CLEANUP
43
44 AT_SETUP([read ASCII as Auto])
45 AT_KEYWORDS([line_reader])
46 AT_CHECK([echo string | line-reader-test read - Auto], [0], [dnl
47 encoded in ASCII (auto)
48 "string"
49 ])
50 AT_CLEANUP
51
52 AT_SETUP([read UTF-8 as Auto])
53 AT_KEYWORDS([line_reader])
54 AT_CHECK([printf 'entr\303\251e\n' | line-reader-test read - Auto], [0], [dnl
55 encoded in ASCII (auto)
56 encoded in UTF-8
57 "entrée"
58 ])
59 AT_CLEANUP
60
61 AT_SETUP([read ISO-8859-1 as Auto,ISO-8859-1])
62 AT_KEYWORDS([line_reader])
63 AT_CHECK([i18n-test supports_encodings ISO-8859-1])
64 buffer_size=`line-reader-test buffer-size`
65 ($PERL -e "print 'x' x ($buffer_size - 2)"
66  printf '\none line\ntwo lines\nentr\351e\nfour lines\n') > input
67 (printf 'encoded in ASCII (auto)\n\"'
68  $PERL -e "print 'x' x ($buffer_size - 2)"
69  printf '\"\n"one line"\n"two lines"\nencoded in ISO-8859-1\n"entr\303\251e"\n"four lines"\n') > expout
70 AT_CHECK([line-reader-test read input Auto,ISO-8859-1], [0], [expout])
71 AT_CLEANUP
72
73 AT_SETUP([read UTF-16BE as Auto,UTF-16BE])
74 AT_KEYWORDS([line_reader])
75 AT_CHECK([i18n-test supports_encodings UTF-16BE])
76 AT_CHECK([printf '\0e\0n\0t\0r\0\351\0e\0\n' | line-reader-test read - Auto,UTF-16BE],
77   [0], [encoded in UTF-16BE
78 "entrée"
79 ])
80 AT_CLEANUP
81
82 AT_SETUP([read EUC-JP as Auto,EUC-JP])
83 AT_KEYWORDS([line_reader])
84 AT_CHECK([i18n-test supports_encodings EUC-JP])
85 AT_CHECK([printf 'entr\217\253\261e\n' | line-reader-test read - Auto,EUC-JP],
86   [0], [encoded in EUC-JP
87 "entrée"
88 ])
89 AT_CLEANUP