Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
turn an RC entry by TimToady++ into an integration tests
Very interesting for us, because it makes nom segfault
  • Loading branch information
moritz committed Aug 3, 2011
1 parent 5451960 commit 5eced30
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions integration/lazy-bentley-generator.t
@@ -0,0 +1,24 @@
use Test;

sub bentley_clever($seed) {
constant $mod = 1_000_000_000;

my @state;

my @seed = ($seed % $mod, 1, (* - *) % $mod ... *)[^55];
@state = @seed[ 34, (* + 34 ) % 55 ... 0 ];

subrand() for 55 .. 219;

sub subrand() {
push @state, (my $x = (@state.shift - @state[*-24]) % $mod);
$x;
}

&subrand ... *;
}

my @sr := bentley_clever(292929);
is @sr[^6].join('|'),
'467478574|512932792|539453717|20349702|615542081|378707948',
'can do funny things with lazy series';

0 comments on commit 5eced30

Please sign in to comment.