1 # Copyright © 2012, 2022 Nick Bowler
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <https://www.gnu.org/licenses/>.
16 AT_SETUP([upkg_decode_index])
17 AT_KEYWORDS([core function])
19 # various encodings of zero
20 m4_foreach_w([INDEX], [00 4000 408000 40808000 4080808000],
21 [AT_CHECK([decodeindex INDEX], [0], [0
25 # truncated encodings of zero
26 m4_foreach_w([INDEX], ['' 40 4080 408080 40808080],
27 [AT_CHECK([decodeindex INDEX], [1], [ignore], [ignore])
30 # overlong encoding of zero
31 AT_CHECK([decodeindex 408080808000], [1], [ignore], [ignore])
35 AT_SETUP([pcx_write_scanline run-length encoding])
36 AT_KEYWORDS([engine function])
38 AT_CHECK([pcxrle 00], [0], [00
40 AT_CHECK([pcxrle 0000], [0], [c200
42 AT_CHECK([pcxrle c100], [0], [c1c100
46 zero4=$zero1$zero1$zero1$zero1
47 zero16=$zero4$zero4$zero4$zero4
48 zero63=$zero16$zero16$zero16$zero4$zero4$zero4$zero1$zero1$zero1
49 zero64=$zero16$zero16$zero16$zero16
50 zero192=$zero64$zero64$zero64
52 AT_CHECK([# maximum possible run
53 pcxrle $zero63], [0], [ff00
55 AT_CHECK([# one more than maximum
56 pcxrle $zero64], [0], [ff0000
58 AT_CHECK([# consecutive runs
59 pcxrle $zero192], [0], [ff00ff00ff00c300