line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: TimedActionFixture.pm,v 1.8 2006/06/16 15:20:56 tonyb Exp $ |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# Copyright (c) 2002-2005 Cunningham & Cunningham, Inc. |
4
|
|
|
|
|
|
|
# Released under the terms of the GNU General Public License version 2 or later. |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Perl translation by Dave W. Smith |
7
|
|
|
|
|
|
|
# Modified by Tony Byrne |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Test::C2FIT::TimedActionFixture; |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
802
|
use base 'Test::C2FIT::ActionFixture'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
12
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
13
|
1
|
|
|
1
|
|
4
|
use Test::C2FIT::Parse; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
281
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub doTable { |
16
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
17
|
0
|
|
|
|
|
|
my ($table) = shift; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$self->SUPER::doTable($table); |
20
|
0
|
|
|
|
|
|
$table->parts()->parts()->last()->more( $self->td("time") ); |
21
|
0
|
|
|
|
|
|
$table->parts()->parts()->last()->more( $self->td("split") ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub formatTime($) { |
25
|
0
|
|
|
0
|
0
|
|
my ($value) = @_; |
26
|
0
|
|
|
|
|
|
my @t = localtime($value); |
27
|
0
|
|
|
|
|
|
my $r = sprintf( "%2d:%02d:%02d", $t[2], $t[1], $t[0] ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# warn "SSS: $r\n"; |
30
|
0
|
|
|
|
|
|
return $r; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub doCells { |
34
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
35
|
0
|
|
|
|
|
|
my ($cells) = @_; |
36
|
0
|
|
|
|
|
|
my $start = $self->time(); |
37
|
0
|
|
|
|
|
|
$self->SUPER::doCells($cells); |
38
|
0
|
|
|
|
|
|
my $split = $self->time() - $start; |
39
|
0
|
|
|
|
|
|
$cells->last()->more( $self->td( formatTime($start) ) ); |
40
|
0
|
|
|
|
|
|
$cells->last()->more( $self->td($split) ); #TBD format? |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub time { |
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
return CORE::time(); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub td { |
49
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
50
|
0
|
|
|
|
|
|
my ($body) = @_; |
51
|
0
|
|
|
|
|
|
return Test::C2FIT::Parse->from( "td", $self->info($body), undef, undef ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |