Permalink
Browse files

mass-insert fixture

  • Loading branch information...
1 parent 3112c04 commit 691a285a21f2ac9f4848e12bf8ac05de99bb2e9a @jasonmay committed Jun 6, 2010
Showing with 54 additions and 0 deletions.
  1. +54 −0 lib/KiokuDB/Test/Fixture/MassInsert.pm
View
54 lib/KiokuDB/Test/Fixture/MassInsert.pm
@@ -0,0 +1,54 @@
+#!/usr/bin/perl
+
+package KiokuDB::Test::Fixture::MassInsert;
+use Moose;
+
+use Test::More;
+use Test::Exception;
+
+use Scalar::Util qw(refaddr);
+
+use KiokuDB::Test::Person;
+
+sub p {
+ my @args = @_;
+ unshift @args, "name" if @args % 2;
+ KiokuDB::Test::Person->new(@args);
+}
+
+with qw(KiokuDB::Test::Fixture) => { excludes => [qw/populate sort/] };
+
+sub sort { -100 }
+
+sub create {
+ return map { p("person$_") } (1 .. 1024);
+}
+
+sub populate {
+ my $self = shift;
+
+ {
+ my $s = $self->new_scope;
+
+ my %people;
+ @people{1 .. 1024} = $self->create;
+ $self->store_ok(%people);
+ }
+
+}
+
+sub verify {
+ my $self = shift;
+
+ {
+ my $s = $self->new_scope;
+ my $p = $self->lookup_ok(1 .. 1024);
+ }
+
+ $self->no_live_objects;
+}
+
+__PACKAGE__
+
+__END__
+

0 comments on commit 691a285

Please sign in to comment.