KiokuDB/Test/Fixture/Scan.pm

filter: Statementstmt 100% 56 / 56 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod 0.0% 0 / 2 totaltotal 97.2% 70 / 72 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« KiokuDB/GC/Naive/Sweep.pm ↑ Summary KiokuDB/Test/Fixture/TXN/Scan.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::Test::Fixture::Scan;
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Test::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use KiokuDB::Test::Person;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 with qw(KiokuDB::Test::Fixture) => { excludes => 'required_backend_roles' };
14  
15 2 ▶use constant required_backend_roles => qw(Clear Scan);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 sub create {
18 66 ▶ my $self = shift;
Subroutine create: called CC=1 SCAR=0.0
Pod undocumented
19  
20 66 ( map { KiokuDB::Test::Person->new(%$_) }
21 { name => "foo", age => 3 },
22 { name => "bar", age => 3 },
23 { name => "gorch", age => 5, friends => [ KiokuDB::Test::Person->new( name => "quxx", age => 6 ) ] },
24 );
25 }
26  
27 before populate => sub {
28 66 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
29 66 $self->backend->clear;
30 2 };
31  
32 sub verify {
33 33 ▶ my $self = shift;
Subroutine verify: called CC=1 SCAR=0.0
Pod undocumented
34  
35 $self->txn_lives(sub {
36 33 ▶ my $root = $self->root_set;
Subroutine __ANON__: called CC=1 SCAR=0.0
37  
38 25 does_ok( $root, "Data::Stream::Bulk" );
39  
40 25 my @objs = $root->all;
41  
42 25 my @ids = $self->objects_to_ids(@objs);
43  
44 is_deeply(
45 25 [ sort map { $_->name } @objs ],
46 [ sort qw(foo bar gorch) ],
47 "root set",
48 );
49  
50 25 is_deeply(
51 [ sort $self->backend->root_entry_ids->all ],
52 [ sort @ids ],
53 "root set IDs",
54 );
55 33 });
56  
57 $self->txn_lives(sub {
58 33 ▶ my $child_entries = $self->backend->child_entries;
Subroutine __ANON__: called CC=1 SCAR=0.0
59  
60 25 does_ok( $child_entries, "Data::Stream::Bulk" );
61 25 ▶ my $children = $child_entries->filter(sub {[ $self->directory->linker->register_and_expand_entries(@$_) ]});
Subroutine __ANON__: called CC=1 SCAR=0.0
62  
63 25 my @objs = $children->all;
64  
65 25 my @ids = $self->objects_to_ids(@objs);
66  
67 is_deeply(
68 25 [ sort map { $_->name } @objs ],
69 [ sort qw(quxx) ],
70 "nonroot entries",
71 );
72  
73 25 is_deeply(
74 [ sort $self->backend->child_entry_ids->all ],
75 [ sort @ids ],
76 "nonroot IDs",
77 );
78 33 });
79  
80 $self->txn_lives(sub {
81 33 ▶ my $all_entries = $self->backend->all_entries;
Subroutine __ANON__: called CC=1 SCAR=0.0
82  
83 25 does_ok( $all_entries, "Data::Stream::Bulk" );
84  
85 25 ▶ my $all = $all_entries->filter(sub {[ $self->directory->linker->register_and_expand_entries(@$_) ]});
Subroutine __ANON__: called CC=1 SCAR=0.0
86  
87 25 my @objs = $all->all;
88  
89 25 my @ids = $self->objects_to_ids(@objs);
90  
91 is_deeply(
92 25 [ sort map { $_->name } @objs ],
93 [ sort qw(foo bar gorch quxx) ],
94 "all entries",
95 );
96  
97 25 is_deeply(
98 [ sort $self->backend->all_entry_ids->all ],
99 [ sort @ids ],
100 "all IDs",
101 );
102 33 });
103 }
104  
105 2 __PACKAGE__->meta->make_immutable;
106  
107 2 __PACKAGE__
108  
109 __END__
110  
« KiokuDB/GC/Naive/Sweep.pm ↑ Summary KiokuDB/Test/Fixture/TXN/Scan.pm »