File: 06-int2bytes.t

package info (click to toggle)
libnet-openid-common-perl 1.20-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 208 kB
  • sloc: perl: 1,072; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 333 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/perl
    
use strict;
use Test::More tests => 2048;
use Net::OpenID::Common;
use Math::BigInt;
    
for my $num (1..2048) {
    my $bi = Math::BigInt->new("2")->bpow($num);
    my $bstr = $bi->bstr;

    my $bytes = OpenID::util::int2bytes($bstr);
    my $bstr2 = OpenID::util::bytes2int($bytes);
    is($bstr,$bstr2);
}