mirror of
https://github.com/hoytech/strfry.git
synced 2025-06-19 01:34:57 +00:00
wip
This commit is contained in:
33
test/xorTest.pl
Normal file
33
test/xorTest.pl
Normal file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use IPC::Open2;
|
||||
use Session::Token;
|
||||
|
||||
my $idSize = 16;
|
||||
|
||||
srand($ENV{SEED} || 0);
|
||||
my $stgen = Session::Token->new(seed => "\x00" x 1024, alphabet => '0123456789abcdef', length => $idSize * 2);
|
||||
|
||||
my $pid = open2(my $outfile, my $infile, './test/xor');
|
||||
|
||||
my $num = rnd(10000) + 1;
|
||||
|
||||
for (1..$num) {
|
||||
my $mode = rnd(3) + 1;
|
||||
my $created = 1677970534 + rnd($num);
|
||||
my $id = $stgen->get;
|
||||
print $infile "$mode,$created,$id\n";
|
||||
}
|
||||
|
||||
close($infile);
|
||||
|
||||
while (<$outfile>) {
|
||||
print $_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
sub rnd {
|
||||
my $n = shift;
|
||||
return int(rand() * $n);
|
||||
}
|
Reference in New Issue
Block a user