Avro/DataFile.pm

filter: Statementstmt 100% 19 / 19 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 89.2% 25 / 28 CC 2 SCAR 3.0
CC
2
Cov
95%
is_codec_valid
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« Avro/Protocol/Message.pm ↑ Summary Avro.pm »
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
8 #
9 # https://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
16 # under the License.
17  
18 package Avro::DataFile;
19 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 1 ▶use constant AVRO_MAGIC => "Obj\x01";
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 1 ▶use Avro::Schema;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 1 our $VERSION = '1.12.2';
27  
28 1 our $HEADER_SCHEMA = Avro::Schema->parse(<<EOH);
29 {"type": "record", "name": "org.apache.avro.file.Header",
30 "fields" : [
31 {"name": "magic", "type": {"type": "fixed", "name": "Magic", "size": 4}},
32 {"name": "meta", "type": {"type": "map", "values": "bytes"}},
33 {"name": "sync", "type": {"type": "fixed", "name": "Sync", "size": 16}}
34 ]
35 }
36 EOH
37  
38 1 our %ValidCodec = (
39 null => 1,
40 deflate => 1,
41 bzip2 => 1,
42 zstandard => 1,
43 );
44  
45 13 ▶sub is_codec_valid {
Subroutine is_codec_valid: called CC=2 SCAR=7.1
Pod undocumented
46 13 my $datafile = shift;
47 13 ▶ my $codec = shift || '';
Condition50%1/2
shift() || ''
l!l
130
MC/DC0%0/1
shift() || ''
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
48 13 return $ValidCodec{$codec};
49 }
50  
51 1 +1;
« Avro/Protocol/Message.pm ↑ Summary Avro.pm »