/[cwmp]/google/trunk/t/06-queue.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /google/trunk/t/06-queue.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 199 - (hide annotations)
Wed Nov 14 18:16:14 2007 UTC (16 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 848 byte(s)
 r210@brr:  dpavlin | 2007-11-14 19:15:41 +0100
 New version [0.09] with buch of changes:
 - command queue for device now really works
 - cpe-queue.pl now supports --list to display queue
 - convert all methods to receive just one param (simplifies code all over)

1 dpavlin 194 #!/usr/bin/perl
2     use strict;
3     use warnings;
4    
5     my $debug = shift @ARGV;
6    
7 dpavlin 199 use Test::More tests => 255;
8 dpavlin 194 use Data::Dump qw/dump/;
9     use lib 'lib';
10    
11     BEGIN {
12     use_ok('CWMP::Queue');
13     }
14    
15     #use Cwd qw/abs_path/;
16     #ok(my $abs_path = abs_path($0), "abs_path");
17     #$abs_path =~ s!/[^/]*$!/!; #!fix-vim
18    
19     ok( my $obj = CWMP::Queue->new({
20     id => 'test',
21     debug => $debug,
22     }), 'new' );
23     isa_ok( $obj, 'CWMP::Queue' );
24    
25     for my $i ( 1 .. 42 ) {
26 dpavlin 199 ok( $obj->enqueue(
27     "command-$i",
28     {
29     i => $i,
30     foo => 'bar',
31     }
32     ), "enqueue $i" );
33 dpavlin 194 };
34    
35     my $i = 1;
36    
37 dpavlin 197 while ( my $job = $obj->dequeue ) {
38     ok( $job, "dequeue $i" );
39 dpavlin 199 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 dpavlin 197 ok( $job->finish, "finish $i" );
44 dpavlin 194 $i++;
45     }

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26