File: test.pl

package info (click to toggle)
libdata-uniqid-perl 0.12-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 80 kB
  • sloc: perl: 108; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 743 bytes parent folder | download | duplicates (4)
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
use Test;
BEGIN { plan tests => 3 };
use Data::Uniqid qw ( suniqid uniqid luniqid ) ;

print "suniqid -> " . suniqid . "\n";
print "uniqid  -> " . uniqid . "\n";
print "luniqid -> " . luniqid . "\n";

for (0..100) {
	$id=suniqid;
	if ($id{$id}) {;$err++;}
	$id{$id}++;
}
if ($err>0) {;ok(0);} else {;ok(1);}

for (0..100) {
	$id=uniqid;
	if ($id{$id}) {;$err++;}
	$id{$id}++;
}
if ($err>0) {;ok(0);} else {;ok(1);}

for (0..100) {
	$id=luniqid;
	if ($id{$id}) {;$err++;}
	$id{$id}++;
}
if ($err>0) {;ok(0);} else {;ok(1);}

#use Sys::Hostname;
#my($ia,$ib,$ic,$id)=unpack("C4", (gethostbyname(hostname()))[4]);
#
#if ($ia=~/\d+/ && $ia>0 && $ib=~/\d+/ && $ib>0 && 
#    $ic=~/\d+/ && $ic>0 && $id=~/\d+/ && $id>0 ) {;ok(1);}
#else {;ok(0);}