# Copyright © 2021, 2023-2024 Nick Bowler
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
AT_BANNER([Internal library behaviour])
AT_SETUP([cdecl__normalize_specs])
AT_KEYWORDS([libcdecl internal])
TEST_NEED_PROGRAM([normalize])
# Note that not all combinations of specifiers make a specifier list that can
# appear in a valid C declaration. We don't want to test normalization of
# invalid specifier lists: each line in the below input file is a specifier
# list that is possible to use.
AT_DATA([input],
[[int long signed long
long int long unsigned
short signed int
int short unsigned
char signed
char unsigned
_Complex float
_Imaginary float
_Imaginary double long
long _Complex double
const struct foo volatile restrict restrict const volatile const restrict
volatile const const restrict union bar restrict volatile volatile const
const const volatile volatile restrict restrict volatile enum baz volatile
int signed long const volatile inline static
short inline int extern volatile unsigned const
_Complex volatile double const long typedef
long const _Imaginary double register volatile
volatile _Bool const auto
]])
AT_CHECK([normalize -f input], [0], [[signed long long int
unsigned long long int
signed short int
unsigned short int
signed char
unsigned char
float _Complex
float _Imaginary
long double _Imaginary
long double _Complex
restrict volatile const struct foo
restrict volatile const union bar
restrict volatile const enum baz
static inline volatile const signed long int
extern inline volatile const unsigned short int
typedef volatile const long double _Complex
register volatile const long double _Imaginary
auto volatile const _Bool
]])
AT_CLEANUP
TEST_TAP_SIMPLE([cdecl__err sanity], [cdeclerr],
[TEST_NEED_PROGRAM([cdeclerr])], [libcdecl internal])
AT_SETUP([cdecl_err thread safety])
AT_KEYWORDS([libcdecl internal threads])dnl
TEST_NEED_PROGRAM([errthread])
AT_XFAIL_IF(
[grep '^#define USE_WINDOWS_THREADS 1' "$builddir/config.h" >/dev/null 2>&1])
TEST_TAP([errthread])
AT_CLEANUP
AT_SETUP([cdecl_declare truncation])
AT_KEYWORDS([libcdecl internal])
AT_DATA([input],
[[int hello_world
int x[1234567890]
]])
AT_CHECK([rendertest -n 0