From: Nick Bowler Date: Tue, 24 Jan 2023 07:37:00 +0000 (-0500) Subject: Avoid POSIX character classes in the test suite. X-Git-Tag: v1.3~177 X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/commitdiff_plain/f0c1e306132c731c95969b6ef653101702d0678f?hp=881854b714cb3987911800c88345ea61db40fb03 Avoid POSIX character classes in the test suite. Instead of [[:alnum:]] and friends, expand to an explicit list of characters, which is a bit more portable usage (and also avoids unneeded locale dependency). We can use macros to make this just as convenient to write. --- diff --git a/tests/stress.at b/tests/stress.at index 51fb0d2..9bc84cf 100644 --- a/tests/stress.at +++ b/tests/stress.at @@ -1,4 +1,4 @@ -# Copyright © 2012, 2020, 2022 Nick Bowler +# Copyright © 2012, 2020, 2022-2023 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 @@ -36,7 +36,7 @@ m4_define([sanity_tests], [dnl [[^type], [type name]], [[inline], [inline function specifier]], [[inline inline], [redundant function specifiers]], - [[function (@<:@@<:@:alnum:@:>@_@:>@* as], [named function parameter]], + [[function (@<:@RE_ALNUM()_@:>@* as], [named function parameter]], [[function (void)], [empty prototype declaration]], [[function returning], [non-prototype function declaration]], [[\.\.\.], [variadic function]], diff --git a/testsuite.at b/testsuite.at index 1e67965..861d2c6 100644 --- a/testsuite.at +++ b/testsuite.at @@ -1,4 +1,4 @@ -AT_COPYRIGHT([Copyright © 2020 Nick Bowler]) +AT_COPYRIGHT([Copyright © 2020-2021, 2023 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 @@ -28,11 +28,16 @@ AT_ARG_OPTION_ARG([random-iterations], [Number of randomized testcases to perform (default: 500)])], [random_iter=$at_optarg], [random_iter=]) +m4_define([RE_LOWER], [abcdefghijklmnopqrstuvwxyz]) +m4_define([RE_UPPER], m4_toupper(m4_defn([RE_LOWER]))) +m4_define([RE_ALPHA], m4_defn([RE_UPPER])m4_defn([RE_LOWER])) +m4_define([RE_ALNUM], m4_defn([RE_ALPHA])[0-9]) + m4_divert_push([PREPARE_TESTS])dnl : ${LIBTOOL="$SHELL $builddir/libtool"} -random_seed=`printf '%s' "$random_seed" | tr -cd '@<:@:digit:@:>@'` +random_seed=`printf '%s' "$random_seed" | tr -cd '0123456789'` random_seed=${random_seed:-0} -random_iter=`printf '%s' "$random_iter" | tr -cd '@<:@:digit:@:>@'` +random_iter=`printf '%s' "$random_iter" | tr -cd '0123456789'` random_iter=`expr "$random_iter" '|' 500` m4_divert_pop([PREPARE_TESTS])