# This file is part of Mailfromd testsuite. -*- Autotest -*- # Copyright (C) 2020 Sergey Poznyakoff # # 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, 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_SETUP([enumerations]) AT_KEYWORDS([const enum]) AT_CHECK([ AT_DATA([prog], [const do A B C D done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], [0], [], [A=0 B=1 C=2 D=3 ]) AT_CHECK([ AT_DATA([prog], [const do A 25/5 + 1 B C D done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], [0], [], [A=6 B=7 C=8 D=9 ]) AT_CHECK([ AT_DATA([prog], [const do A B C 15 D done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], [0], [], [A=0 B=1 C=15 D=16 ]) AT_CHECK([ AT_DATA([prog], [const do A "one" B "two" C "three" D "four" done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], [0], [], [A=one B=two C=three D=four ]) AT_CHECK([ AT_DATA([prog], [const do A B C "two" D "three" done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], [0], [], [A=0 B=1 C=two D=three ]) AT_CHECK([ AT_DATA([prog], [const do A B "one" C D done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], EX_CONFIG, [], [mailfromd: prog:6.3: initializer element is not numeric ]) AT_CHECK([ AT_DATA([prog], [precious const do A B C D done func main(...) returns number do echo "A=".A echo "B=".B echo "C=".C echo "D=".D done ]) mailfromd MAILFROMD_LOGOPTS MAILFROMD_OPTIONS --run prog ], EX_CONFIG, [], [mailfromd: prog:1.1-8: `precious' used with const ]) AT_CLEANUP