/[Redis.pre-github]/t/01-Redis.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

Diff of /t/01-Redis.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 53 by dpavlin, Tue Mar 24 22:51:53 2009 UTC revision 63 by dpavlin, Mon Sep 14 11:37:25 2009 UTC
# Line 3  Line 3 
3  use warnings;  use warnings;
4  use strict;  use strict;
5    
6  use Test::More tests => 106;  use Test::More tests => 108;
7  use Data::Dump qw/dump/;  use Data::Dumper;
8    
9  use lib 'lib';  use lib 'lib';
10    
# Line 16  ok( my $o = Redis->new(), 'new' ); Line 16  ok( my $o = Redis->new(), 'new' );
16    
17  ok( $o->ping, 'ping' );  ok( $o->ping, 'ping' );
18    
19    ok( $o = Redis->new( server => 'localhost:6379' ), 'new with server' );
20    
21  diag "Commands operating on string values";  diag "Commands operating on string values";
22    
# Line 49  is_deeply( [ $o->mget( 'foo', 'key-next' Line 50  is_deeply( [ $o->mget( 'foo', 'key-next'
50    
51  my @keys;  my @keys;
52    
53  foreach ( 0 .. $key_next ) {  foreach my $id ( 0 .. $key_next ) {
54          my $key = 'key-' . $_;          my $key = 'key-' . $id;
55          push @keys, $key;          push @keys, $key;
56          ok(     $o->set( $key => $_ ),           "set $key" );          ok(     $o->set( $key => $id ),           "set $key" );
57          ok(  $o->exists( $key       ),           "exists $key" );          ok(  $o->exists( $key       ),           "exists $key" );
58          cmp_ok( $o->get( $key       ), 'eq', $_, "get $key" );          cmp_ok( $o->get( $key       ), 'eq', $id, "get $key" );
59          cmp_ok( $o->incr( 'key-next' ), '==', $_ + 1, 'incr' );          cmp_ok( $o->incr( 'key-next' ), '==', $id + 1, 'incr' );
60          cmp_ok( $o->decr( 'key-left' ), '==', $key_next - $_ - 1, 'decr' );          cmp_ok( $o->decr( 'key-left' ), '==', $key_next - $id - 1, 'decr' );
61  }  }
62    
63  cmp_ok( $o->get( 'key-next' ), '==', $key_next + 1, 'key-next' );  cmp_ok( $o->get( 'key-next' ), '==', $key_next + 1, 'key-next' );
# Line 138  cmp_ok( $o->scard( $set ), '==', 0, 'sca Line 139  cmp_ok( $o->scard( $set ), '==', 0, 'sca
139  $o->sadd( 'test-set1', $_ ) foreach ( 'foo', 'bar', 'baz' );  $o->sadd( 'test-set1', $_ ) foreach ( 'foo', 'bar', 'baz' );
140  $o->sadd( 'test-set2', $_ ) foreach ( 'foo', 'baz', 'xxx' );  $o->sadd( 'test-set2', $_ ) foreach ( 'foo', 'baz', 'xxx' );
141    
142  my $inter = [ 'baz', 'foo' ];  my $inter = [ 'foo', 'baz' ];
143    
144  is_deeply( [ $o->sinter( 'test-set1', 'test-set2' ) ], $inter, 'siter' );  is_deeply( [ $o->sinter( 'test-set1', 'test-set2' ) ], $inter, 'siter' );
145    
# Line 182  diag "shutdown not tested"; Line 183  diag "shutdown not tested";
183  diag "Remote server control commands";  diag "Remote server control commands";
184    
185  ok( my $info = $o->info, 'info' );  ok( my $info = $o->info, 'info' );
186  diag dump( $info );  isa_ok( $info, 'HASH' );
187    diag Dumper( $info );
188    
189  diag "Connection handling";  diag "Connection handling";
190    

Legend:
Removed from v.53  
changed lines
  Added in v.63

  ViewVC Help
Powered by ViewVC 1.1.26