| 1 | #!/usr/bin/perl |
| 2 | # Copyright 2022 Jeffrey Kegler |
| 3 | # This file is part of Marpa::R2. Marpa::R2 is free software: you can |
| 4 | # redistribute it and/or modify it under the terms of the GNU Lesser |
| 5 | # General Public License as published by the Free Software Foundation, |
| 6 | # either version 3 of the License, or (at your option) any later version. |
| 7 | # |
| 8 | # Marpa::R2 is distributed in the hope that it will be useful, |
| 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 | # Lesser General Public License for more details. |
| 12 | # |
| 13 | # You should have received a copy of the GNU Lesser |
| 14 | # General Public License along with Marpa::R2. If not, see |
| 15 | # http://www.gnu.org/licenses/. |
| 16 | |
| 17 | # Regressions tests involving the Stuizand interface |
| 18 | |
| 19 | use 5.010001scip-perl cpan Marpa-R2 12.000000 `5.010001`/; |
| 20 | use strictscip-perl cpan Marpa-R2 12.000000 strict/; |
| 21 | use warningsscip-perl cpan Marpa-R2 12.000000 warnings/; |
| 22 | use Test::Morescip-perl cpan Marpa-R2 12.000000 Test/More/ tests => 1; |
| 23 | |
| 24 | use libscip-perl cpan Marpa-R2 12.000000 lib/ 'inc'; |
| 25 | use Marpa::R2::Testscip-perl cpan Marpa-R2 12.000000 Marpa/R2/Test/; |
| 26 | |
| 27 | ## no critic (ErrorHandling::RequireCarping); |
| 28 | |
| 29 | use Marpa::R2scip-perl cpan Marpa-R2 12.000000 Marpa/R2/; |
| 30 | |
| 31 | # Regression test of bug found by Andrew Rodland |
| 32 | |
| 33 | my $g = Marpa::R2::Grammar->newscip-perl cpan Marpa-R2 12.000000 Marpa/R2/Grammar/new().( |
| 34 | { actions => "main", |
| 35 | start => "start", |
| 36 | source => \"start ::= action => act" |
| 37 | } |
| 38 | ); |
| 39 | $g->precomputescip-perl cpan Marpa-R2 12.000000 Marpa/R2/Grammar/precompute().; |
| 40 | my $r = Marpa::R2::Recognizer->newscip-perl cpan Marpa-R2 12.000000 Marpa/R2/Recognizer/new().( { grammar => $g } ); |
| 41 | my $value_ref = $r->valuescip-perl cpan Marpa-R2 12.000000 Marpa/R2/Recognizer/value().; |
| 42 | my $value = definedscip-perl cpan Marpa-R2 12.000000 main/defined(). $value_ref ? ${$value_ref} : 'No parse'; |
| 43 | sub actscip-perl cpan Marpa-R2 12.000000 main/act(). {123}; |
| 44 | |
| 45 | Test::More::isscip-perl cpan Marpa-R2 12.000000 Test/More/is().( $value, '123', 'Rodland regression test' ); |
| 46 | |
| 47 | # vim: expandtab shiftwidth=4: |