Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

Ovid
  (email not shown publicly)
http://publius-ovidius.livejournal.com/
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Sunday May 15, 2005
03:01 PM

Diffing different version outputs

[ #24707 ]

After playing around with a new parser for AI::Prolog, I realized that I was being stupid. I was visually comparing the differences between my old and new parsers. How silly of me! A bit of namespace massaging gave me this:

use Test::More 'no_plan';
use Test::Differences;
use AI::Prolog::Parser; # must come before the use lib
use lib 'AI-Prolog-0.66/lib';
use AI::Prolog::ParserTwo;

my $parser1 = AI::Prolog::Parser->new;
my $parser2 = AI::Prolog::ParserTwo->new;

my @clauses = (
  'foo.',
  'bar.',
  '3.',
  'foo(bar).',
);

foreach my $clause (@clauses) {
  my $kb1 = $parser1->consult($clause);
  my $kb2 = $parser2->consult($clause);
  eq_or_diff $kb1, $kb2,
    "Parsers should return identical values for ($clause)";
}

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.