"Fossies" - the Fresh Open Source Software Archive 
Member "memcached-1.6.15/t/issue_42.t" (21 Feb 2022, 769 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 #!/usr/bin/perl
2
3 use strict;
4 use Test::More tests => 11;
5 use FindBin qw($Bin);
6 use lib "$Bin/lib";
7 use MemcachedTest;
8
9 my $server = new_memcached("-o no_modern");
10 my $sock = $server->sock;
11 my $value = "B"x10;
12 my $key = 0;
13 my $key_count = 10;
14
15 for ($key = 0; $key < $key_count; $key++) {
16 print $sock "set key$key 0 0 10\r\n$value\r\n";
17 is (scalar <$sock>, "STORED\r\n", "stored key$key");
18 }
19
20 my $stats = mem_stats($sock, "slabs");
21 my $stats2 = mem_stats($sock, "items");
22 my $req = $stats2->{"items:1:mem_requested"};
23 my $top = $stats->{"1:chunk_size"} * $key_count;
24 # unreasonable for the result to be < 500 bytes (min item header is 48), but
25 # should be less than the maximum potential number.
26 ok ($req > 500 && $req < $top, "Check allocated size: $req $top");