Permalink
Browse files

Add failing tests for repeatedly running an optimizer.

  • Loading branch information...
1 parent 128fb26 commit f0b280734c645ff4c581b335c70331d7fc0d781c tcurtis committed Jul 30, 2010
Showing with 7 additions and 1 deletion.
  1. +7 −1 t/tree-optimizer.t
View
@@ -2,7 +2,7 @@
pir::load_bytecode('Tree/Optimizer.pbc');
-plan(13);
+plan(16);
{
my $opt := Tree::Optimizer.new;
@@ -33,6 +33,8 @@ plan(13);
$opt.register(&transform);
ok($opt.run(5) == -5,
'Simple Sub pass runs correctly.');
+ ok($opt.run(5) == -5,
+ 'Tree::Optimizer.run works repeatedly.');
}
{
@@ -48,13 +50,17 @@ plan(13);
$opt.register(&negate, :depends-on<square>);
ok($opt.run(2) == -4,
'Correct order when registering a pass after its dependency.');
+ ok($opt.run(2) == -4,
+ 'Repeated correct order when registering a pass after its dependency.');
}
{
my $opt := Tree::Optimizer.new;
$opt.register(&negate, :depends-on<square>);
$opt.register(&square, :name<square>);
ok($opt.run(2) == -4,
'Correct order when registering a pass after its dependency.');
+ ok($opt.run(2) == -4,
+ 'Repeated correct order when registering a pass after its dependency.');
}
{
my $opt := Tree::Optimizer.new;

0 comments on commit f0b2807

Please sign in to comment.