=================================================================== RCS file: /cvs/HOPE/Net-OpenAMD/t/network_tests.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HOPE/Net-OpenAMD/t/network_tests.t 2010/06/26 17:33:33 1.1 +++ HOPE/Net-OpenAMD/t/network_tests.t 2010/06/26 17:47:01 1.2 @@ -1,19 +1,21 @@ #!perl package NetworkTests; -# $AFresh1$ +# $AFresh1: network_tests.t,v 1.1 2010/06/26 16:33:33 andrew Exp $ + use strict; use warnings; use Test::More; use Net::OpenAMD; -if (!caller()) { - if ($ENV{'NETWORK_TESTS'}) { - # plan tests => ??; +if ( !caller() ) { + if ( $ENV{'NETWORK_TESTS'} ) { + + # plan tests => ??; } else { - plan skip_all => "Set env NETWORK_TESTS to test" + plan skip_all => "Set env NETWORK_TESTS to test"; } my $amd = Net::OpenAMD->new(); @@ -27,5 +29,46 @@ sub run_tests { 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' ); + } + } }