Moose/Instrument/HPE4400B.pm untested

filter: Statementstmt 0.0% 0 / 47 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 85 CC 4 SCAR 15.5
CC
4
Cov
0%
BUILD
12.0
validate_trace_param
6.0
BEGIN
2.0
CRAP 4.7
1 package Lab::Moose::Instrument::HPE4400B;
2 $Lab::Moose::Instrument::HPE4400B::VERSION = '3.931';
3 #ABSTRACT: HP E4400B Series Spectrum Analyzer
4  
5 use v5.20;
6  
7  
8 use PDL::Core qw/pdl cat nelem/;
9  
10 use Moose;
11 use Moose::Util::TypeConstraints;
12 use MooseX::Params::Validate;
13 use Lab::Moose::Instrument qw/
14 timeout_param
15 precision_param
16 validated_getter
17 validated_setter
18 validated_channel_getter
19 validated_channel_setter
20 /;
21 use Lab::Moose::Instrument::Cache;
22 use Carp;
23 use namespace::autoclean;
24  
25 extends 'Lab::Moose::Instrument';
26  
27 with 'Lab::Moose::Instrument::SpectrumAnalyzer', qw(
28 Lab::Moose::Instrument::Common
29  
30 Lab::Moose::Instrument::SCPI::Format
31  
32 Lab::Moose::Instrument::SCPI::Sense::Bandwidth
33 Lab::Moose::Instrument::SCPI::Sense::Frequency
34 Lab::Moose::Instrument::SCPI::Sense::Sweep
35 Lab::Moose::Instrument::SCPI::Sense::Power
36 Lab::Moose::Instrument::SCPI::Display::Window
37 Lab::Moose::Instrument::SCPI::Unit
38  
39 Lab::Moose::Instrument::SCPI::Initiate
40  
41 Lab::Moose::Instrument::SCPIBlock
42  
43 );
44  
45 sub BUILD {
46 my $self = shift;
47  
48 # limitation of hardware
49 my $firmware = $self->idn_firmware;
50 my $model = $self->idn_model;
51 if (!$firmware ||
52 $firmware !~ /^A\.(\d+)\.\d+$/ ||
53 $1 < 4)
54 {
55 $self->capable_to_query_number_of_X_points_in_hardware(0);
56 }
57  
58 if (!$model || $model !~ /^E440[12457]B$/) {
59 print STDERR "Model $model does not support setting X points\n";
60 $self->capable_to_set_number_of_X_points_in_hardware(0);
61 $self->hardwired_number_of_X_points(401);
62 }
63  
64 $self->clear();
65 $self->cls();
66 }
67  
68  
69 sub validate_trace_param {
70 my ( $self, $trace ) = @_;
71 if ( $trace < 1 || $trace > 3 ) {
72 confess "trace has to be in (1..3)";
73 }
74 return $trace;
75 }
76  
77  
78 __PACKAGE__->meta()->make_immutable();
79  
80 1;
81  
82 __END__