File: bigfile.t

package info (click to toggle)
ciphersaber 1.01-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye, buster
  • size: 108 kB
  • sloc: perl: 313; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 699 bytes parent folder | download | duplicates (2)
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
26
27
28
#!perl -w

BEGIN
{
	chdir 't' if -d 't';
}

use strict;
use Test::More tests => 2;

use_ok( 'Crypt::CipherSaber' );

my $cs = Crypt::CipherSaber->new( 'sdrawkcabsihtdaeR' );
open( INPUT, 'smiles.cs1' ) or die "Couldn't open: $!";
binmode(INPUT);
my $mode = 0644;
chmod( $mode, 'smiles.png' ) or die "Couldn't change permissions: $!";
open(OUTPUT, '> smiles.png') or die "Couldn't open: $!";
binmode(OUTPUT);
$cs->fh_crypt(\*INPUT, \*OUTPUT);
close INPUT;
close OUTPUT;
$mode = 0444;
chmod( $mode, 'smiles.png' ) or die "Couldn't change permissions: $!";
open(TEST, 'smiles.png') or die "Couldn't open: $!";
my $line = <TEST>;

like( $line, qr/PNG/, 'Encrypting a large file should not mangle it' );