]> git.draconx.ca Git - upkg.git/blob - tests/functions.at
Stop using gnulib's flexmember module.
[upkg.git] / tests / functions.at
1 # Copyright © 2012, 2022 Nick Bowler
2 #
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.
7 #
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.
12 #
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/>.
15
16 AT_SETUP([upkg_decode_index])
17 AT_KEYWORDS([core function])
18
19 # various encodings of zero
20 m4_foreach_w([INDEX], [00 4000 408000 40808000 4080808000],
21   [AT_CHECK([decodeindex INDEX], [0], [0
22 ])
23 ])
24
25 # truncated encodings of zero
26 m4_foreach_w([INDEX], ['' 40 4080 408080 40808080],
27   [AT_CHECK([decodeindex INDEX], [1], [ignore], [ignore])
28 ])
29
30 # overlong encoding of zero
31 AT_CHECK([decodeindex 408080808000], [1], [ignore], [ignore])
32
33 AT_CLEANUP
34
35 AT_SETUP([pcx_write_scanline run-length encoding])
36 AT_KEYWORDS([engine function])
37
38 AT_CHECK([pcxrle 00], [0], [00
39 ])
40 AT_CHECK([pcxrle 0000], [0], [c200
41 ])
42 AT_CHECK([pcxrle c100], [0], [c1c100
43 ])
44
45 zero1=00
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
51
52 AT_CHECK([# maximum possible run
53 pcxrle $zero63], [0], [ff00
54 ])
55 AT_CHECK([# one more than maximum
56 pcxrle $zero64], [0], [ff0000
57 ])
58 AT_CHECK([# consecutive runs
59 pcxrle $zero192], [0], [ff00ff00ff00c300
60 ])
61
62 AT_CLEANUP