File: 17.t

package info (click to toggle)
libcache-fastmmap-perl 1.58-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 356 kB
  • sloc: ansic: 1,399; perl: 628; makefile: 7
file content (32 lines) | stat: -rw-r--r-- 674 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#########################

use Test::More tests => 186;
BEGIN { use_ok('Cache::FastMmap') };
use Storable qw(freeze thaw);
use strict;

#########################

# Test that we actually re-use deleted slots in a cache

my $FC = Cache::FastMmap->new(
  page_size => 65536,
  num_pages => 1,
  init_file => 1,
  serializer => '',
  start_slots => 89,
);
ok( defined $FC );

ok($FC->set("foo", "a" x 31000), "set foo");
ok($FC->set("bar", "b" x 31000), "set bar");

for (1 .. 90) {
  ok($FC->set("a", "$_"), "set $_");
  ok($FC->get("a") eq "$_", "get $_");
  $FC->remove("a");
}

ok($FC->get("foo") eq "a" x 31000, "get foo");
ok($FC->get("bar") eq "b" x 31000, "get bar");