Acme-RJWETMORE-Utils

 view release on metacpan or  search on metacpan

lib/Acme/RJWETMORE/Utils.pm  view on Meta::CPAN

They can be integers or floating points.  They can be decimal, binary, 
hexadecimal, octal or mixed bases.  


    use Acme::RJWETMORE::Utils;

    my $result = sum( $n1, $n2, ... );

    # Examples and special cases:
    sum( 1, -2, 3, -4 )       # -2
    sum()                     # undef 
    sum(1, 2, 'a' )           # 3 
    sum( 'a', 'b' )           # 0 
    sum( 0b11, 0xA, 010, 20 ) # 41 

=head1 EXPORT

sum()

=head1 SUBROUTINES/METHODS

t/sum.t  view on Meta::CPAN

BEGIN {
    use_ok( 'Acme::RJWETMORE::Utils' ) || BAIL_OUT();
}

diag( "Testing Acme::RJWETMORE::Utils $Acme::RJWETMORE::Utils::VERSION, Perl $], $^X" );

ok( defined &sum, 'defined sum' );

## Testing sum()
## Null argument
is( sum(), undef, 'sum() = undef  --- null arg' );

## One argument
is( sum(55), 55, 'sum(55) = 55  --- one arg' );

## positive integers
is( sum(1,2,3), 6, 'sum(1,2,3) = 6  --- pos ints' );

## postitive and negative integers
is( sum(1,-2,3,-4), -2, 
                   'sum(1,-2,3,-4) = -2 --- pos and neg ints' );



( run in 1.165 second using v1.01-cache-2.11-cpan-d80b1682f3f )