OpenSky/Core/StateVector.pm

filter: Statementstmt 42.8% 12 / 28 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 32.0% 17 / 53 CC 9 SCAR 32.5
CC
9
Cov
27%
category_name
42.0
position_source_name
20.0
BEGIN
1.0
CRAP 25.8
↑ Summary OpenSky.pm »
1 package WebService::OpenSky::Core::StateVector;
2  
3 # ABSTRACT: A class representing a state from the OpenSky Network API
4  
5 8 ▶use WebService::OpenSky::Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 8 our $VERSION = '0.5';
7  
8 8 my @PARAMS = qw(
9 icao24
10 callsign
11 origin_country
12 time_position
13 last_contact
14 longitude
15 latitude
16 baro_altitude
17 on_ground
18 velocity
19 true_track
20 vertical_rate
21 sensors
22 geo_altitude
23 squawk
24 spi
25 position_source
26 category
27 );
28  
29 8 param [@PARAMS];
30  
31 3 ▶around 'BUILDARGS' => sub ( $orig, $class, $state ) {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 3 my %value_for;
33 3 @value_for{@PARAMS} = @$state;
34 3 return $class->$orig(%value_for);
35 8 };
36  
37 1 ▶sub _get_params ($class) {@PARAMS}
Subroutine _get_params: called CC=1 SCAR=0.0
38  
39 0 ▶method category_name() {
Subroutine category_name: not called CC=6 SCAR=37.4
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method category_name (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for method category_name (expected 1, got ' . @_ . ')') 0 0 0
40 0 ▶ my $category = $self->category // 0;
Condition0%0/2
$self->category // 0
l!l
00
MC/DC0%0/1
$self->category // 0
$self->category
Truth table0%0/2
A
A= $self->category
Aresult
11
00
41 0 ▶ $category = 0 if $category > 20;
Branch: 1 branch
BranchTrueFalseTotal
if $category > 20 0 0 0
42 0 ▶ return '' unless $category;
Branch: 1 branch
BranchTrueFalseTotal
unless $category 0 0 0
43 0 my @names = (
44 'No information at all',
45 'No ADS-B Emitter Category Information',
46 'Light (< 15500 lbs)',
47 'Small (15500 to 75000 lbs)',
48 'Large (75000 to 300000 lbs)',
49 'High Vortex Large (aircraft such as B-757)',
50 'Heavy (> 300000 lbs)',
51 'High Performance (> 5g acceleration and 400 kts)',
52 'Rotorcraft',
53 'Glider / sailplane',
54 'Lighter-than-air',
55 'Parachutist / Skydiver',
56 'Ultralight / hang-glider / paraglider',
57 'Reserved',
58 'Unmanned Aerial Vehicle',
59 'Space / Trans-atmospheric vehicle',
60 'Surface Vehicle – Emergency Vehicle',
61 'Surface Vehicle – Service Vehicle',
62 'Point Obstacle (includes tethered balloons)',
63 'Cluster Obstacle',
64 'Line Obstacle',
65 );
66 0 return $names[$category];
67 8 }
68  
69 0 ▶method position_source_name() {
Subroutine position_source_name: not called CC=4 SCAR=30.0
Pod documented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method position_source_name (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for method position_source_name (expected 1, got ' . @_ . ')') 0 0 0
70 0 ▶ my $source = $self->position_source // return 'Uknown';
Condition0%0/2
$self->position_source // (return "Uknown")
l!l
00
MC/DC0%0/1
$self->position_source // (return "Uknown")
$self->position_source
Truth table0%0/2
A
A= $self->position_source
Aresult
11
00
71 0 my @sources = (
72 'ADS-B',
73 'ASTERIX',
74 'MLAT',
75 'FLARM',
76 );
77 0 return $sources[$source];
78 }
79  
80 __END__
↑ Summary OpenSky.pm »