blob: 295a5fcd929ba146f51be1d386015f95cd91dacd (
plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
$NetBSD: patch-aa,v 1.2 2004/12/05 16:29:15 he Exp $
--- t/test.t.orig Tue Feb 16 15:24:51 1999
+++ t/test.t
@@ -1,45 +1,26 @@
-#! /usr/bin/env perl
-##
-## vi:ts=4
-##
-##---------------------------------------------------------------------------##
-##
-
+use Test::More tests => 4;
use Compress::Bzip2;
my $SourceString;
my $TargetString;
my $TargetOutString;
-my $InputFile;
-my $OutputFile;
-
-if ($ARGV[0] ne '') { $InputFile=$ARGV[0]; }
-else { $InputFile='test.t'; }
-
-$OutputFile=">".$InputFile.".dek";
-
-if (-e $InputFile) {
- open(INPUT, $InputFile);
- while(<INPUT>) {
- $SourceString.=$_;
- }
- print "\n\nDie Datei wurde eingelesen.\n";
- print "Die OrginalDatei hat die Groesse: ".length($SourceString)."\n\n";
-
- $TargetString=Compress::Bzip2::compress($SourceString);
- print "Bzip-Com: ".length($TargetString)."\n";
-
- $TargetOutString=Compress::Bzip2::decompress($TargetString);
-
-
- print "Bzip-Dec: ".length($TargetOutString)."\n";
-
- open(OUTPUT, $OutputFile);
- print OUTPUT $TargetOutString;
+my $inputFile;
+if (-d 't') {
+ $InputFile='t/test.t';
+} else {
+ $InputFile='test.t';
}
-else {
- print "Datei ".$InputFile." konnte nicht geoeffnet werden.";
+
+open(INPUT, $InputFile);
+while(<INPUT>) {
+ $SourceString.=$_;
}
-#Ende
+ok(length($SourceString), 'test file');
+$TargetString=Compress::Bzip2::compress($SourceString);
+ok($TargetString, 'compression');
+# print "Bzip-Com ".length($TargetString)."\n";
+$TargetOutString=Compress::Bzip2::decompress($TargetString);
+ok($TargetOutString, 'decompression');
+ok(length($TargetOutString) eq length($SourceString), 'compress/decompress');
|