File Coverage

test/test_get.pl
Criterion Covered Total %
statement 15 15 100.0
branch 7 14 50.0
condition n/a
subroutine 2 2 100.0
pod n/a
total 24 31 77.4


line stmt bran cond sub pod time code
1             #!/usr/bin/perl -w
2              
3 1     1   6 use strict;
  1         1  
  1         42  
4 1     1   535 use IPC::Cache;
  1         4  
  1         2273  
5              
6 1         3 my $sUSAGE = "Usage: test_get.pl cache_key namespace key expected_value";
7              
8 1 50       5 my $cache_key = $ARGV[0] or
9             die("$sUSAGE\n");
10              
11 1 50       4 my $namespace = $ARGV[1] or
12             die("$sUSAGE\n");
13              
14 1 50       3 my $key = $ARGV[2] or
15             die("sUSAGE\n");
16              
17 1 50       3 my $expected_value = $ARGV[3] or
18             die("sUSAGE\n");
19              
20 1 50       14 my $cache = new IPC::Cache( { cache_key => $cache_key, namespace => $namespace } ) or
21             die("Couldn't create cache");
22              
23 1 50       6 my $value = $cache->get($key) or
24             die("Couldn't get object at $key");
25              
26 1 50       3 $value eq $expected_value or
27             die("value $value not equal to $expected_value");
28              
29 1         12 exit(0);
30              
31