]> git.draconx.ca Git - cdecl99.git/blob - t/installcheck.c
Add a basic "make installcheck" function.
[cdecl99.git] / t / installcheck.c
1 /*
2  * Post-installation sanity check for libcdecl.
3  *
4  * Copyright © 2023 Nick Bowler
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
18  */
19
20 #include <cdecl.h>
21
22 int main(void)
23 {
24         extern int puts(const char *);
25
26         struct cdecl_declarator decl_array, decl_null = {0};
27         struct cdecl_declspec spec = {0, CDECL_TYPE_INT};
28         struct cdecl decl = {0, &spec, &decl_array};
29         char buf[100];
30
31         decl_array.child = &decl_null;
32         decl_array.type = CDECL_DECL_ARRAY;
33         decl_array.u.array.length = 1234567890;
34         decl_array.u.array.vla = NULL;
35
36         cdecl_explain(buf, sizeof buf, &decl);
37         puts(buf);
38 }