~brianaker/libmemcached/1164440

« back to all changes in this revision

Viewing changes to memcached/t/issue_104.t

Merge working tree with build tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
 
 
3
use strict;
 
4
use Test::More tests => 6;
 
5
use FindBin qw($Bin);
 
6
use lib "$Bin/lib";
 
7
use MemcachedTest;
 
8
 
 
9
my $server = new_memcached();
 
10
my $sock = $server->sock;
 
11
 
 
12
# first get should miss
 
13
print $sock "get foo\r\n";
 
14
is(scalar <$sock>, "END\r\n", "get foo");
 
15
 
 
16
# Now set and get (should hit)
 
17
print $sock "set foo 0 0 6\r\nfooval\r\n";
 
18
is(scalar <$sock>, "STORED\r\n", "stored foo");
 
19
mem_get_is($sock, "foo", "fooval");
 
20
 
 
21
my $stats = mem_stats($sock);
 
22
is($stats->{cmd_get}, 2, "Should have 2 get requests");
 
23
is($stats->{get_hits}, 1, "Should have 1 hit");
 
24
is($stats->{get_misses}, 1, "Should have 1 miss");