1*0Sstevel@tonic-gate#!/usr/bin/perl 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gateuse lib '..'; 4*0Sstevel@tonic-gateuse Memoize qw(memoize unmemoize); 5*0Sstevel@tonic-gate 6*0Sstevel@tonic-gateprint "1..5\n"; 7*0Sstevel@tonic-gate 8*0Sstevel@tonic-gateeval { unmemoize('f') }; # Should fail 9*0Sstevel@tonic-gateprint (($@ ? '' : 'not '), "ok 1\n"); 10*0Sstevel@tonic-gate 11*0Sstevel@tonic-gate{ my $I = 0; 12*0Sstevel@tonic-gate sub u { $I++ } 13*0Sstevel@tonic-gate} 14*0Sstevel@tonic-gatememoize('u'); 15*0Sstevel@tonic-gatemy @ur = (&u, &u, &u); 16*0Sstevel@tonic-gateprint (("@ur" eq "0 0 0") ? "ok 2\n" : "not ok 2\n"); 17*0Sstevel@tonic-gate 18*0Sstevel@tonic-gateeval { unmemoize('u') }; # Should succeed 19*0Sstevel@tonic-gateprint ($@ ? "not ok 3\n" : "ok 3\n"); 20*0Sstevel@tonic-gate 21*0Sstevel@tonic-gate@ur = (&u, &u, &u); 22*0Sstevel@tonic-gateprint (("@ur" eq "1 2 3") ? "ok 4\n" : "not ok 4\n"); 23*0Sstevel@tonic-gate 24*0Sstevel@tonic-gateeval { unmemoize('u') }; # Should fail 25*0Sstevel@tonic-gateprint ($@ ? "ok 5\n" : "not ok 5\n"); 26*0Sstevel@tonic-gate 27