-
Notifications
You must be signed in to change notification settings - Fork 15
/
14.t
42 lines (27 loc) · 842 Bytes
/
14.t
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
33
34
35
36
37
38
39
40
41
#########################
use Test::More tests => 110;
BEGIN { use_ok('Cache::FastMmap') };
use strict;
#########################
# Insert your test code below, the Test::More module is use()ed here so read
# its man page ( perldoc Test::More ) for help writing this test script.
my $FC = Cache::FastMmap->new(
enable_stats => 1
);
ok( defined $FC );
ok( !defined $FC->get("a") );
$FC->set("a", "b");
ok( $FC->get("a") eq "b" );
# Get 100 times
for (1 .. 100) {
ok( $FC->get("a") eq "b" );
}
my ($nreads, $nreadhits) = $FC->get_statistics();
cmp_ok( $nreads, '==', 102 );
cmp_ok( $nreadhits, '==', 101 );
($nreads, $nreadhits) = $FC->get_statistics(1);
cmp_ok( $nreads, '==', 102 );
cmp_ok( $nreadhits, '==', 101 );
($nreads, $nreadhits) = $FC->get_statistics(1);
cmp_ok( $nreads, '==', 0 );
cmp_ok( $nreadhits, '==', 0 );