~yolanda.robla/ubuntu/trusty/memcached/add_distribution

« back to all changes in this revision

Viewing changes to t/issue_22.t

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2009-08-01 23:26:45 UTC
  • mto: (3.3.1 squeeze) (1.4.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20090801232645-g57xdaf3zal53qcl
Tags: upstream-1.4.0
Import upstream version 1.4.0

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 => 84;
 
5
use FindBin qw($Bin);
 
6
use lib "$Bin/lib";
 
7
use MemcachedTest;
 
8
 
 
9
my $server = new_memcached("-m 3");
 
10
my $sock = $server->sock;
 
11
my $value = "B"x66560;
 
12
my $key = 0;
 
13
 
 
14
for ($key = 0; $key < 40; $key++) {
 
15
    print $sock "set key$key 0 0 66560\r\n$value\r\n";
 
16
    is (scalar <$sock>, "STORED\r\n", "stored key$key");
 
17
}
 
18
 
 
19
my $first_stats  = mem_stats($sock, "items");
 
20
my $first_evicted = $first_stats->{"items:31:evicted"};
 
21
# I get 1 eviction on a 32 bit binary, but 4 on a 64 binary..
 
22
# Just check that I have evictions...
 
23
isnt ($first_evicted, "0", "check evicted");
 
24
 
 
25
print $sock "stats reset\r\n";
 
26
is (scalar <$sock>, "RESET\r\n", "Stats reset");
 
27
 
 
28
my $second_stats  = mem_stats($sock, "items");
 
29
my $second_evicted = $second_stats->{"items:31:evicted"};
 
30
is ("0", $second_evicted, "check evicted");
 
31
 
 
32
for ($key = 40; $key < 80; $key++) {
 
33
    print $sock "set key$key 0 0 66560\r\n$value\r\n";
 
34
    is (scalar <$sock>, "STORED\r\n", "stored key$key");
 
35
}
 
36
 
 
37
my $last_stats  = mem_stats($sock, "items");
 
38
my $last_evicted = $last_stats->{"items:31:evicted"};
 
39
is ($last_evicted, "40", "check evicted");