Filename | /2home/ss5/perl5/perlbrew/perls/perl-5.12.3/lib/site_perl/5.12.3/Test/Deep/Stack.pm |
Statements | Executed 16 statements in 376µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 334µs | 460µs | BEGIN@9 | Test::Deep::Stack::
1 | 1 | 1 | 13µs | 15µs | BEGIN@1.34 | Test::Deep::
1 | 1 | 1 | 8µs | 18µs | BEGIN@2.35 | Test::Deep::
1 | 1 | 1 | 7µs | 20µs | BEGIN@7 | Test::Deep::Stack::
1 | 1 | 1 | 7µs | 32µs | BEGIN@6 | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | getLast | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | incArrow | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | init | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | length | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | pop | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | push | Test::Deep::Stack::
0 | 0 | 0 | 0s | 0s | render | Test::Deep::Stack::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 3 | 18µs | 2 | 17µs | # spent 15µs (13+2) within Test::Deep::BEGIN@1.34 which was called:
# once (13µs+2µs) by Test::Deep::BEGIN@8 at line 1 # spent 15µs making 1 call to Test::Deep::BEGIN@1.34
# spent 2µs making 1 call to strict::import |
2 | 3 | 32µs | 2 | 28µs | # spent 18µs (8+10) within Test::Deep::BEGIN@2.35 which was called:
# once (8µs+10µs) by Test::Deep::BEGIN@8 at line 2 # spent 18µs making 1 call to Test::Deep::BEGIN@2.35
# spent 10µs making 1 call to warnings::import |
3 | |||||
4 | package Test::Deep::Stack; | ||||
5 | |||||
6 | 3 | 18µs | 2 | 57µs | # spent 32µs (7+25) within Test::Deep::Stack::BEGIN@6 which was called:
# once (7µs+25µs) by Test::Deep::BEGIN@8 at line 6 # spent 32µs making 1 call to Test::Deep::Stack::BEGIN@6
# spent 25µs making 1 call to Exporter::import |
7 | 3 | 21µs | 2 | 32µs | # spent 20µs (7+13) within Test::Deep::Stack::BEGIN@7 which was called:
# once (7µs+13µs) by Test::Deep::BEGIN@8 at line 7 # spent 20µs making 1 call to Test::Deep::Stack::BEGIN@7
# spent 13µs making 1 call to Exporter::import |
8 | |||||
9 | 3 | 287µs | 2 | 521µs | # spent 460µs (334+125) within Test::Deep::Stack::BEGIN@9 which was called:
# once (334µs+125µs) by Test::Deep::BEGIN@8 at line 9 # spent 460µs making 1 call to Test::Deep::Stack::BEGIN@9
# spent 62µs making 1 call to Test::Deep::MM::import |
10 | |||||
11 | sub init | ||||
12 | { | ||||
13 | my $self = shift; | ||||
14 | |||||
15 | $self->SUPER::init(@_); | ||||
16 | |||||
17 | $self->setStack([]) unless $self->getStack; | ||||
18 | } | ||||
19 | |||||
20 | sub push | ||||
21 | { | ||||
22 | my $self = shift; | ||||
23 | |||||
24 | push(@{$self->getStack}, @_); | ||||
25 | } | ||||
26 | |||||
27 | sub pop | ||||
28 | { | ||||
29 | my $self = shift; | ||||
30 | |||||
31 | return pop @{$self->getStack}; | ||||
32 | } | ||||
33 | |||||
34 | sub render | ||||
35 | { | ||||
36 | my $self = shift; | ||||
37 | my $var = shift; | ||||
38 | |||||
39 | my $stack = $self->getStack; | ||||
40 | |||||
41 | $self->setArrow(0); | ||||
42 | |||||
43 | foreach my $data (@$stack) | ||||
44 | { | ||||
45 | my $exp = $data->{exp}; | ||||
46 | if (Scalar::Util::blessed($exp) and $exp->isa("Test::Deep::Cmp")) | ||||
47 | { | ||||
48 | $var = $exp->render_stack($var, $data); | ||||
49 | |||||
50 | $self->setArrow(0) if $exp->reset_arrow; | ||||
51 | } | ||||
52 | else | ||||
53 | { | ||||
54 | confess "Don't know how to render '$exp'"; | ||||
55 | } | ||||
56 | } | ||||
57 | |||||
58 | return $var; | ||||
59 | } | ||||
60 | |||||
61 | sub getLast | ||||
62 | { | ||||
63 | my $self = shift; | ||||
64 | |||||
65 | return $self->getStack->[-1]; | ||||
66 | } | ||||
67 | |||||
68 | sub incArrow | ||||
69 | { | ||||
70 | my $self = shift; | ||||
71 | |||||
72 | my $a = $self->getArrow; | ||||
73 | $self->setArrow($a + 1); | ||||
74 | |||||
75 | return $a; | ||||
76 | } | ||||
77 | |||||
78 | sub length | ||||
79 | { | ||||
80 | my $self = shift; | ||||
81 | |||||
82 | return @{$self->getStack} + 0; | ||||
83 | } | ||||
84 | |||||
85 | 1 | 2µs | 1; |