blib/lib/UAV/Pilot/WumpusRover/Video/Mock.pm untested

filter: Statementstmt 0.0% 0 / 31 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 44 CC 1 SCAR 6.9
CC
1
Cov
0%
_build_io
2.0
_send_heartbeat
2.0
BEGIN
2.0
CRAP 2.0
1 # Copyright (c) 2014 Timm Murray
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are met:
6 #
7 # * Redistributions of source code must retain the above copyright notice,
8 # this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
12 #
13 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 # POSSIBILITY OF SUCH DAMAGE.
24 package UAV::Pilot::WumpusRover::Video::Mock;
25 use v5.14;
26 use warnings;
27 use Moose;
28 use namespace::autoclean;
29 use UAV::Pilot::WumpusRover::Video;
30  
31 extends 'UAV::Pilot::WumpusRover::Video';
32  
33 has 'file' => (
34 is => 'ro',
35 isa => 'Str',
36 );
37 has 'heartbeat_count' => (
38 is => 'rw',
39 isa => 'Int',
40 );
41  
42  
43 sub _build_io
44 {
45 my ($class, $args) = @_;
46 my $file = $$args{file};
47 open( my $fh, '<', $file )
48 or UAV::Pilot::IOException->throw(
49 error => "Could not open file '$file': $!",
50 );
51 return $fh;
52 }
53  
54 sub _send_heartbeat
55 {
56 my ($self, $checksum) = @_;
57 $self->heartbeat_count( $self->heartbeat_count + 1 );
58 return 1;
59 }
60  
61  
62 no Moose;
63 __PACKAGE__->meta->make_immutable;
64 1;
65 __END__
66