File: seed-coverage.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 (24 lines) | stat: -rw-r--r-- 523 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
use Session::Token;

## The point of this test is to verify that every byte of the seed is
## propogated to the ISAAC context and therefore impacts the token
## sequence.

use strict;

use Test::More tests => 1;

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


foreach my $seed ("\x00" x 1024, "\x00" x 1023 . "\x01", "\x01" . "\x00" x 1023) {
  my $ctx = Session::Token->new( seed => $seed, );

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

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