blib/lib/LucyX/Search/MockMatcher.pm

filter: Statementstmt 100% 23 / 23 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 94.1% 32 / 34 CC 4 SCAR 10.0
CC
4
Cov
93%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
« blib/lib/Lucy.pm ↑ Summary blib/lib/LucyX/Search/Filter.pm »
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements. See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License. You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15  
16 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 package LucyX::Search::MockMatcher;
20 9 ▶use Lucy;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 9 our $VERSION = '0.008000';
22 9 $VERSION = eval $VERSION;
23  
24 3763 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod documented
25 3763 my ( $either, %args ) = @_;
26 3763 ▶ confess("Missing doc_ids") unless ref( $args{doc_ids} ) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"doc_ids"} eq "ARRAY" 0 3763 3763
27 3763 my $doc_ids = Lucy::Object::I32Array->new( ints => $args{doc_ids} );
28 3763 my $size = $doc_ids->get_size;
29 3763 my $scores;
30 3763 ▶ if ( ref( $args{scores} ) eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args{"scores"} eq "ARRAY") 3762 1 3763
31 confess("Mismatch between scores and doc_ids array sizes")
32 3762 ▶ unless scalar @{ $args{scores} } == $size;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$args{"scores"};} == $size 0 3762 3762
33 $scores = Clownfish::Blob->new(
34 3762 pack( "f$size", @{ $args{scores} } ) );
35 }
36  
37 3763 return $either->_new(
38 doc_ids => $doc_ids,
39 scores => $scores,
40 );
41 }
42  
43 9 1;
44  
45 __END__
« blib/lib/Lucy.pm ↑ Summary blib/lib/LucyX/Search/Filter.pm »