tests: style changes

* tests/c++.at (C++ Variant-based Symbols): Rename as...
(C++ Variant-based Symbols Unit Tests): this.
Comment/style changes.
This commit is contained in:
Akim Demaille
2018-08-26 07:55:45 +02:00
parent b476c143c0
commit 15233a3728

View File

@@ -88,11 +88,14 @@ AT_BISON_OPTION_POPDEFS
AT_CLEANUP AT_CLEANUP
## --------------------------- ## ## -------------------------------------- ##
## C++ Variant-based Symbols. ## ## C++ Variant-based Symbols Unit Tests. ##
## --------------------------- ## ## -------------------------------------- ##
AT_SETUP([C++ Variant-based Symbols]) # Not checking the grammar, only the variants and variant based
# symbols.
AT_SETUP([C++ Variant-based Symbols Unit Tests])
AT_KEYWORDS([variant]) AT_KEYWORDS([variant])
@@ -115,7 +118,7 @@ AT_DATA_GRAMMAR([list.y],
} }
%token <int> INT "int" %token <int> INT "int"
%type < std::vector<int> > exp %type <std::vector<int>> exp
%printer { yyo << $$; } <int> %printer { yyo << $$; } <int>
%printer %printer
@@ -126,7 +129,7 @@ AT_DATA_GRAMMAR([list.y],
yyo << ", "; yyo << ", ";
yyo << *i; yyo << *i;
} }
} < std::vector<int> > } <std::vector<int>>
%code requires { #include <vector> } %code requires { #include <vector> }
%code { int yylex (yy::parser::semantic_type* yylval); } %code { int yylex (yy::parser::semantic_type* yylval); }
@@ -139,17 +142,20 @@ exp: "int" { $$.push_back ($1); }
int main() int main()
{ {
// symbol_type: construction, accessor.
{ {
yy::parser::symbol_type s = yy::parser::make_INT(12); yy::parser::symbol_type s = yy::parser::make_INT(12);
std::cerr << s.value.as<int>() << '\n'; std::cerr << s.value.as<int>() << '\n';
} }
// stack_symbol_type: construction, accessor.
{ {
yy::parser::symbol_type s = yy::parser::make_INT(123); yy::parser::symbol_type s = yy::parser::make_INT(123);
yy::parser::stack_symbol_type ss(1, s); yy::parser::stack_symbol_type ss(1, s);
std::cerr << ss.value.as<int>() << '\n'; std::cerr << ss.value.as<int>() << '\n';
} }
// pushing on the stack.
{ {
yy::parser::stack_type st; yy::parser::stack_type st;
for (int i = 0; i < 100; ++i) for (int i = 0; i < 100; ++i)