version 1.1, 2010/06/26 17:33:33 |
version 1.2, 2010/06/26 17:47:01 |
|
|
#!perl |
#!perl |
package NetworkTests; |
package NetworkTests; |
# $AFresh1$ |
|
|
|
|
# $AFresh1: network_tests.t,v 1.1 2010/06/26 16:33:33 andrew Exp $ |
|
|
use strict; |
use strict; |
use warnings; |
use warnings; |
|
|
use Test::More; |
use Test::More; |
use Net::OpenAMD; |
use Net::OpenAMD; |
|
|
if (!caller()) { |
if ( !caller() ) { |
if ($ENV{'NETWORK_TESTS'}) { |
if ( $ENV{'NETWORK_TESTS'} ) { |
# plan tests => ??; |
|
|
# plan tests => ??; |
} |
} |
else { |
else { |
plan skip_all => "Set env NETWORK_TESTS to test" |
plan skip_all => "Set env NETWORK_TESTS to test"; |
} |
} |
|
|
my $amd = Net::OpenAMD->new(); |
my $amd = Net::OpenAMD->new(); |
|
|
sub run_tests { |
sub run_tests { |
my ($amd) = @_; |
my ($amd) = @_; |
|
|
ok(1); |
my %tests = ( |
|
location => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
speakers => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
talks => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
interests => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
users => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
stats => [ |
|
{ args => undef, |
|
expect => {}, |
|
}, |
|
], |
|
); |
|
|
|
foreach my $method ( keys %tests ) { |
|
foreach my $test ( @{ $tests{$method} } ) { |
|
no warnings 'uninitialized'; |
|
my $result; |
|
eval { $result = $amd->$method( $test->{args} ) }; |
|
is( $@, undef, "$method($test->{args})" ); |
|
is( $result, $test->{expect}, 'got expected result' ); |
|
} |
|
} |
} |
} |