]> git.draconx.ca Git - cdecl99.git/blobdiff - tests/internal.at
Hand-code the normalized specifier ordering.
[cdecl99.git] / tests / internal.at
diff --git a/tests/internal.at b/tests/internal.at
new file mode 100644 (file)
index 0000000..e9fdcf4
--- /dev/null
@@ -0,0 +1,71 @@
+# Copyright © 2021 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 <https://www.gnu.org/licenses/>.
+
+AT_BANNER([Internal library behaviour])
+
+AT_SETUP([cdecl__normalize_specs])
+
+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