File: array_confusion.t

package info (click to toggle)
perl 5.8.4-8sarge6
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 58,128 kB
  • ctags: 31,422
  • sloc: perl: 224,262; ansic: 155,398; sh: 32,253; pascal: 7,747; lisp: 6,121; makefile: 2,341; cpp: 2,035; yacc: 1,019; java: 23
file content (43 lines) | stat: -rwxr-xr-x 611 bytes parent folder | download | duplicates (6)
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
42
43
#!/usr/bin/perl

use lib '..';
use Memoize 'memoize', 'unmemoize';

sub reff {
  return [1,2,3];

}

sub listf {
  return (1,2,3);
}

print "1..6\n";

memoize 'reff', LIST_CACHE => 'MERGE';
print "ok 1\n";
memoize 'listf';
print "ok 2\n";

$s = reff();
@a = reff();
print @a == 1 ? "ok 3\n" : "not ok 3\n";

$s = listf();
@a = listf();
print @a == 3 ? "ok 4\n" : "not ok 4\n";

unmemoize 'reff';
memoize 'reff', LIST_CACHE => 'MERGE';
unmemoize 'listf';
memoize 'listf';

@a = reff();
$s = reff();
print @a == 1 ? "ok 5\n" : "not ok 5\n";

@a = listf();
$s = listf();
print @a == 3 ? "ok 6\n" : "not ok 6\n";