| version 1.10, 2010/07/13 04:23:48 |
version 1.13, 2010/07/14 02:54:03 |
|
|
| #!perl |
#!perl |
| package NetworkTests; |
package NetworkTests; |
| |
|
| # $AFresh1: network_tests.t,v 1.9 2010/07/13 02:27:06 andrew Exp $ |
# $AFresh1: network_tests.t,v 1.12 2010/07/13 06:10:31 andrew Exp $ |
| |
|
| use strict; |
use strict; |
| use warnings; |
use warnings; |
|
|
| use Test::More; |
use Test::More; |
| use Test::Deep; |
use Test::Deep; |
| use Net::OpenAMD; |
use Net::OpenAMD; |
| use Data::Dumper; |
|
| |
|
| |
#use Data::Dumper; |
| |
|
| if ( !caller() ) { |
if ( !caller() ) { |
| if ( $ENV{'NETWORK_TESTS'} ) { |
if ( $ENV{'NETWORK_TESTS'} ) { |
| plan tests => 13; |
plan tests => 31; |
| } |
} |
| else { |
else { |
| plan skip_all => |
plan skip_all => |
|
|
| boolean => any( 'True', 'False' ), |
boolean => any( 'True', 'False' ), |
| ); |
); |
| |
|
| #$cmp{speaker} = $cmp{single_line}; |
$cmp{user} = [ |
| |
$cmp{single_line}, |
| |
superhashof( |
| |
{ name => $cmp{single_line}, |
| |
|
| |
#interests => array_each( $cmp{interests} ), |
| |
#x => $cmp{coordinate}, |
| |
#y => $cmp{coordinate}, |
| |
} |
| |
), |
| |
]; |
| |
|
| |
$cmp{speaker} = [ |
| |
$cmp{single_line}, |
| |
{ name => $cmp{single_line}, |
| |
bio => $cmp{multi_line}, |
| |
} |
| |
]; |
| |
|
| |
$cmp{location} = superhashof( |
| |
{ area => $cmp{area}, |
| |
user => $cmp{digits}, |
| |
|
| |
#button => $cmp{boolean}, |
| |
x => $cmp{coordinate}, |
| |
y => $cmp{coordinate}, |
| |
|
| |
#time => $cmp{single_line}, |
| |
} |
| |
); |
| |
|
| my %tests = ( |
my %tests = ( |
| location => [ |
location => [ |
| { args => undef, |
{ args => undef, |
| expect => array_each( |
expect => array_each( $cmp{location} ), |
| { area => $cmp{area}, |
|
| user => $cmp{digits}, |
|
| button => $cmp{boolean}, |
|
| x => $cmp{coordinate}, |
|
| y => $cmp{coordinate}, |
|
| time => $cmp{single_line}, |
|
| } |
|
| ), |
|
| }, |
}, |
| { args => { user => 'user0' }, |
{ args => { user => 'user0' }, |
| expect => array_each(), |
expect => array_each(), |
| }, |
}, |
| |
{ args => { user => 'user0', limit => 5 }, |
| |
expect => array_each(), |
| |
}, |
| |
{ args => { area => 'Engressa' }, |
| |
expect => array_each(), |
| |
}, |
| ], |
], |
| speakers => [ |
speakers => [ |
| { args => undef, |
{ args => undef, |
| expect => array_each( |
expect => array_each( $cmp{speaker} ), |
| [ $cmp{single_line}, |
|
| { name => $cmp{single_line}, |
|
| bio => $cmp{multi_line}, |
|
| } |
|
| ] |
|
| ), |
|
| }, |
}, |
| |
{ args => { name => 'The Cheshire Catalyst' }, |
| |
expect => array_each( $cmp{speaker} ), |
| |
}, |
| ], |
], |
| talks => [ |
talks => [ |
| { args => undef, |
{ args => undef, |
|
|
| } |
} |
| ), |
), |
| }, |
}, |
| |
{ args => { interests => 'lockpicking' }, |
| |
expect => array_each( |
| |
{ abstract => $cmp{multi_line}, |
| |
speakers => array_each( $cmp{single_line} ), |
| |
time => $cmp{single_line}, |
| |
title => $cmp{single_line}, |
| |
track => $cmp{track}, |
| |
|
| |
# interests => 'lockpicking', |
| |
} |
| |
), |
| |
}, |
| ], |
], |
| interests => [ |
interests => [ |
| { args => undef, |
{ args => undef, |
|
|
| ], |
], |
| users => [ |
users => [ |
| { args => undef, |
{ args => undef, |
| expect => array_each( |
expect => array_each( $cmp{user} ), |
| $cmp{single_line}, |
}, |
| { name => $cmp{single_line}, |
{ args => { user => 'user0' }, |
| |
expect => array_each( $cmp{user} ), |
| #interests => array_each( $cmp{interests} ), |
}, |
| #x => $cmp{coordinate}, |
{ args => { user => 'user0', limit => 20 }, |
| #y => $cmp{coordinate}, |
expect => array_each( $cmp{user} ), |
| } |
}, |
| ), |
{ args => { interests => 'lockpicking' }, |
| |
expect => array_each( $cmp{user} ), |
| }, |
}, |
| ], |
], |
| stats => [ |
stats => [ |