Permalink
Browse files

Add a reproduction test.

  • Loading branch information...
1 parent 9e96743 commit 891d159fc0087e6f129bfd5a66137018eb2692db @hiratara committed Sep 27, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 t/basic.t
View
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+use Algorithm::Simpath;
+use Test::More;
+
+sub count($); sub count($) {
+ my $node = shift;
+ return 0 unless $node;
+ return 1 unless ref $node;
+ $node->{count} //= count($node->{low}) + count($node->{high});
+}
+
+my $zdd = solve(
+ start => 'A',
+ goal => 'C',
+ edges => [[qw(A B)], [qw(C A)], [qw(D A)], [qw(B D)], [qw(B C)], [qw(C D)]],
+);
+is +(count $zdd), 5;
+
+TODO: {
+ local $TODO = "FIXME: Can't count if patthes are ordered randomly.";
+ my $zdd = solve(
+ start => 'A',
+ goal => 'C',
+ edges => [[qw(A B)], [qw(B C)], [qw(C A)], [qw(D A)], [qw(C D)], [qw(B D)]],
+ );
+ is +(count $zdd), 5;
+}
+
+done_testing;

0 comments on commit 891d159

Please sign in to comment.