[BACK]Return to network_tests.t CVS log [TXT][DIR] Up to [local] / HOPE / Net-OpenAMD / t

File: [local] / HOPE / Net-OpenAMD / t / network_tests.t (download)

Revision 1.3, Sat Jun 26 16:50:40 2010 UTC (14 years ago) by andrew
Branch: MAIN
Changes since 1.2: +2 -2 lines

yay? 12 failing tests, next to make them pass.

#!perl
package NetworkTests;

# $AFresh1: network_tests.t,v 1.3 2010/06/26 16:50:40 andrew Exp $

use strict;
use warnings;

use Test::More;
use Net::OpenAMD;

if ( !caller() ) {
    if ( $ENV{'NETWORK_TESTS'} ) {

        # plan tests => ??;
    }
    else {
        plan skip_all => "Set env NETWORK_TESTS to test";
    }

    my $amd = Net::OpenAMD->new();
    run_tests($amd);

    done_testing();
}

1;

sub run_tests {
    my ($amd) = @_;

    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,           "AMD->$method($test->{args})" );
            is( $result, $test->{expect}, 'got expected result' );
        }
    }
}