public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 2e2d5636d8479d088586cba1ba67322dd78f5cbe 618 bytes (raw)
$ git show HEAD:t/sha.t	# shows this blob on the CLI

 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
 
#!perl -w
# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use v5.12;
use PublicInbox::SHA;
use Test::More;

{
	my $dig = PublicInbox::SHA->new(1);
	open my $fh, '<', 'COPYING' or die "open: $!";
	$dig->add(do { local $/; <$fh> });
	is($dig->hexdigest, '78e50e186b04c8fe1defaa098f1c192181b3d837',
		'AGPL-3 matches');
}

SKIP: {
	my $n = $ENV{TEST_LEAK_NR} or skip 'TEST_LEAK_NR unset', 1;
	for (1..$n) {
		PublicInbox::SHA->new(1)->add('hello')->digest;
		PublicInbox::SHA->new(1)->add('hello');
		PublicInbox::SHA->new(1);
	}
}

done_testing;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git