line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/usr/bin/perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package KiokuDB::Test::Fixture::GIN::Class; |
4
|
2
|
|
|
2
|
|
1846
|
use Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
9897
|
use Test::More; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
18
|
|
7
|
2
|
|
|
2
|
|
528
|
use Test::Moose; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
14
|
|
8
|
2
|
|
|
2
|
|
802
|
use Scalar::Util qw(refaddr); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
119
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
995
|
use Search::GIN::Query::Class; |
|
2
|
|
|
|
|
129554
|
|
|
2
|
|
|
|
|
112
|
|
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
16
|
use namespace::clean -except => 'meta'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
15
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
extends qw(KiokuDB::Test::Fixture::Small); |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
919
|
use constant required_backend_roles => qw(Clear Scan Query::GIN); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
891
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
before populate => sub { |
19
|
|
|
|
|
|
|
my $self = shift; |
20
|
|
|
|
|
|
|
$self->backend->clear; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub verify { |
24
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
36
|
my $q_person = Search::GIN::Query::Class->new( class => "KiokuDB::Test::Person" ); |
27
|
1
|
|
|
|
|
137
|
my $q_employee = Search::GIN::Query::Class->new( class => "KiokuDB::Test::Employee" ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$self->txn_lives(sub { |
30
|
1
|
|
|
1
|
|
10
|
my @objs = $self->root_set->all; |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
|
|
|
65
|
my $people = $self->search($q_person); |
33
|
1
|
|
|
|
|
343
|
my $employees = $self->search($q_employee); |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
207
|
does_ok($_, "Data::Stream::Bulk") for ( $people, $employees ); |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
1229
|
my @people = $people->all; |
38
|
1
|
|
|
|
|
41
|
my @employees = $employees->all; |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
41
|
is_deeply( |
41
|
1
|
|
|
|
|
40
|
[ sort map { refaddr($_) } @employees ], |
42
|
|
|
|
|
|
|
[ refaddr($self->lookup_ok($self->joe)) ], |
43
|
|
|
|
|
|
|
"employees", |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
3
|
|
|
|
|
11
|
is_deeply( |
47
|
3
|
|
|
|
|
21
|
[ sort map { refaddr($_) } @people ], |
48
|
1
|
|
|
|
|
539
|
[ sort map { refaddr($_) } @objs, @{ $self->lookup_ok($self->joe)->parents } ], |
|
1
|
|
|
|
|
40
|
|
49
|
|
|
|
|
|
|
"set of all people", |
50
|
|
|
|
|
|
|
); |
51
|
1
|
|
|
|
|
88
|
}); |
52
|
|
|
|
|
|
|
|
53
|
1
|
|
|
|
|
347
|
$self->no_live_objects; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->txn_lives(sub { |
56
|
1
|
|
|
1
|
|
7
|
my ( $joe, $mum, $oscar ) = sort { $a->name cmp $b->name } $self->search($q_person)->all; |
|
3
|
|
|
|
|
116
|
|
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
26
|
is( $joe->name, "joe", "loaded first object" ); |
59
|
1
|
|
|
|
|
514
|
is( $mum->name, "mum", "loaded second object" ); |
60
|
1
|
|
|
|
|
356
|
is( $oscar->name, "oscar", "loaded third object" ); |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
|
|
362
|
is( $joe->parents->[0], $mum, "interrelated objects loaded in one graph" ); |
63
|
1
|
|
|
|
|
12
|
}); |
64
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
372
|
$self->no_live_objects; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |