5 my $debug = shift @ARGV;
7 use Test::More tests => 255;
8 use Data::Dump qw/dump/;
12 use_ok('CWMP::Queue');
15 #use Cwd qw/abs_path/;
16 #ok(my $abs_path = abs_path($0), "abs_path");
17 #$abs_path =~ s!/[^/]*$!/!; #!fix-vim
19 ok( my $obj = CWMP::Queue->new({
23 isa_ok( $obj, 'CWMP::Queue' );
25 for my $i ( 1 .. 42 ) {
37 while ( my $job = $obj->dequeue ) {
38 ok( $job, "dequeue $i" );
39 ok( my ( $dispatch, $args ) = $job->dispatch, "job->dispatch $i" );
40 cmp_ok( $dispatch, 'eq', "command-$i", "dispatch $i" );
41 diag "args = ",dump( $args ) if $debug;
42 cmp_ok( $args->{i}, '==', $i, "args i == $i" );
43 ok( $job->finish, "finish $i" );