File: TraitTest.pm

package info (click to toggle)
libclass-trait-perl 0.31-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 364 kB
  • ctags: 156
  • sloc: perl: 2,467; makefile: 46
file content (32 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

package TraitTest;

use strict;
use warnings;

use base qw(TraitTestBase);    

use Class::Trait (
    TCompositeTest => { 
        alias   => { stringValue => "strVal" },
        exclude => [ "stringValue" ]
    },
    "TPrintable"
    );
    

sub compare {
   my ($self, $right) = @_;
   return ($self->{value} <=> $right->{value});
}

sub toString {
	my ($self) = @_;
	return sprintf("%.3f", $self->SUPER::toString()) . " (overridden stringification)";
}

sub compositeTestRequirement { return "Composite Test Requirement" }

1;

__DATA__