Annotation of HOPE/Net-OpenAMD/t/network_tests.t, Revision 1.3
1.1 andrew 1: #!perl
2: package NetworkTests;
1.2 andrew 3:
1.3 ! andrew 4: # $AFresh1: network_tests.t,v 1.2 2010/06/26 16:47:01 andrew Exp $
1.1 andrew 5:
6: use strict;
7: use warnings;
8:
9: use Test::More;
10: use Net::OpenAMD;
11:
1.2 andrew 12: if ( !caller() ) {
13: if ( $ENV{'NETWORK_TESTS'} ) {
14:
15: # plan tests => ??;
1.1 andrew 16: }
17: else {
1.2 andrew 18: plan skip_all => "Set env NETWORK_TESTS to test";
1.1 andrew 19: }
20:
21: my $amd = Net::OpenAMD->new();
22: run_tests($amd);
23:
24: done_testing();
25: }
26:
27: 1;
28:
29: sub run_tests {
30: my ($amd) = @_;
31:
1.2 andrew 32: my %tests = (
33: location => [
34: { args => undef,
35: expect => {},
36: },
37: ],
38: speakers => [
39: { args => undef,
40: expect => {},
41: },
42: ],
43: talks => [
44: { args => undef,
45: expect => {},
46: },
47: ],
48: interests => [
49: { args => undef,
50: expect => {},
51: },
52: ],
53: users => [
54: { args => undef,
55: expect => {},
56: },
57: ],
58: stats => [
59: { args => undef,
60: expect => {},
61: },
62: ],
63: );
64:
65: foreach my $method ( keys %tests ) {
66: foreach my $test ( @{ $tests{$method} } ) {
67: no warnings 'uninitialized';
68: my $result;
69: eval { $result = $amd->$method( $test->{args} ) };
1.3 ! andrew 70: is( $@, undef, "AMD->$method($test->{args})" );
1.2 andrew 71: is( $result, $test->{expect}, 'got expected result' );
72: }
73: }
1.1 andrew 74: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>