4 use Test::More tests => 15;
5 BEGIN { use_ok('IndexData::Utils::PersistentCounter') };
7 my $file = "/tmp/id-u-pc-$$";
8 my $counter = new IndexData::Utils::PersistentCounter($file);
9 ok(!defined $counter, "can't open non-existent counter");
11 $counter = new IndexData::Utils::PersistentCounter("/x/$file", 1);
12 ok(!defined $counter, "can't create counter in silly place");
14 $counter = new IndexData::Utils::PersistentCounter($file, 1);
15 ok(defined $counter, "created new counter: $!");
17 foreach my $i (1..10) {
18 my $n = $counter->next();
22 ### should test access from multiple processes
25 $counter = new IndexData::Utils::PersistentCounter($file);
26 ok(!defined $counter, "can't open deleted counter");