File: kernel-seeding.t

package info (click to toggle)
libsession-token-perl 1.503-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 196 kB
  • sloc: ansic: 166; perl: 90; makefile: 3
file content (25 lines) | stat: -rw-r--r-- 564 bytes parent folder | download | duplicates (3)
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
use Session::Token;

## The point of this test is to verify that the kernel seeding interface
## (ie /dev/urandom or Crypt::Random::Source::Strong::Win32) is working
## and gives us a different stream each time. Note that this test is
## technically non-deterministic but a failure is very unlikely.

use strict;

use Test::More tests => 1;

my $tokens = {};
my $token_count = 0;


for (1..2) {
  my $ctx = Session::Token->new;

  for my $i (1..2000) {
    $tokens->{$ctx->get} = 1;
    $token_count++;
  }
}

is(scalar keys %$tokens, $token_count, "no uniques");