]> git.draconx.ca Git - cdecl99.git/blob - tests/internal.at
Hand-code the normalized specifier ordering.
[cdecl99.git] / tests / internal.at
1 # Copyright © 2021 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_BANNER([Internal library behaviour])
17
18 AT_SETUP([cdecl__normalize_specs])
19
20 TEST_NEED_PROGRAM([normalize])
21
22 # Note that not all combinations of specifiers make a specifier list that can
23 # appear in a valid C declaration.  We don't want to test normalization of
24 # invalid specifier lists: each line in the below input file is a specifier
25 # list that is possible to use.
26 AT_DATA([input],
27 [[int long signed long
28 long int long unsigned
29 short signed int
30 int short unsigned
31 char signed
32 char unsigned
33 _Complex float
34 _Imaginary float
35 _Imaginary double long
36 long _Complex double
37
38 const struct foo volatile restrict restrict const volatile const restrict
39 volatile const const restrict union bar restrict volatile volatile const
40 const const volatile volatile restrict restrict volatile enum baz volatile
41
42 int signed long const volatile inline static
43 short inline int extern volatile unsigned const
44 _Complex volatile double const long typedef
45 long const _Imaginary double register volatile
46 volatile _Bool const auto
47 ]])
48
49 AT_CHECK([normalize -f input], [0], [[signed long long int
50 unsigned long long int
51 signed short int
52 unsigned short int
53 signed char
54 unsigned char
55 float _Complex
56 float _Imaginary
57 long double _Imaginary
58 long double _Complex
59
60 restrict volatile const struct foo
61 restrict volatile const union bar
62 restrict volatile const enum baz
63
64 static inline volatile const signed long int
65 extern inline volatile const unsigned short int
66 typedef volatile const long double _Complex
67 register volatile const long double _Imaginary
68 auto volatile const _Bool
69 ]])
70
71 AT_CLEANUP