| 1 | BEGIN { |
| 2 | if ($ENVscip-perl cpan Compress-Raw-Lzma 2.221 main/`%ENV`.{PERL_CORE}) { |
| 3 | chdirscip-perl cpan Compress-Raw-Lzma 2.221 main/chdir(). 't' if -d 't'; |
| 4 | #@INC = ("../lib", "lib/compress"); |
| 5 | @INCscip-perl cpan Compress-Raw-Lzma 2.221 main/`@INC`. = ("../lib"); |
| 6 | } |
| 7 | } |
| 8 | |
| 9 | use libscip-perl cpan Compress-Raw-Lzma 2.221 lib/ 't'; |
| 10 | use strictscip-perl cpan Compress-Raw-Lzma 2.221 strict/; |
| 11 | use warningsscip-perl cpan Compress-Raw-Lzma 2.221 warnings/; |
| 12 | use bytesscip-perl cpan Compress-Raw-Lzma 2.221 bytes/; |
| 13 | |
| 14 | use Test::Morescip-perl cpan Compress-Raw-Lzma 2.221 Test/More/ ; |
| 15 | #use CompTestUtils; |
| 16 | |
| 17 | |
| 18 | BEGIN |
| 19 | { |
| 20 | # use Test::NoWarnings, if available |
| 21 | my $extra = 0 ; |
| 22 | $extra = 1 |
| 23 | if eval { requirescip-perl cpan Compress-Raw-Lzma 2.221 main/require(). Test::NoWarnings ; import Test::NoWarnings; 1 }; |
| 24 | |
| 25 | |
| 26 | my $count = 0 ; |
| 27 | if ($]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. < 5.005) { |
| 28 | $count = 199 ; |
| 29 | } |
| 30 | elsif ($]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. >= 5.006) { |
| 31 | $count = 785 ; |
| 32 | } |
| 33 | else { |
| 34 | $count = 227 ; |
| 35 | } |
| 36 | |
| 37 | planscip-perl cpan Compress-Raw-Lzma 2.221 main/plan(). tests => $count + $extra; |
| 38 | |
| 39 | use_okscip-perl cpan Compress-Raw-Lzma 2.221 main/use_ok().('Compress::Raw::Lzma') ; |
| 40 | } |
| 41 | |
| 42 | sub titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). |
| 43 | { |
| 44 | #diag "" ; |
| 45 | ok 1, $_scip-perl cpan Compress-Raw-Lzma 2.221 main/`@_`.[0] ; |
| 46 | #diag "" ; |
| 47 | } |
| 48 | |
| 49 | sub mkErrscip-perl cpan Compress-Raw-Lzma 2.221 main/mkErr(). |
| 50 | { |
| 51 | my $string = shiftscip-perl cpan Compress-Raw-Lzma 2.221 main/shift(). ; |
| 52 | my ($dummy, $file, $line) = callerscip-perl cpan Compress-Raw-Lzma 2.221 main/caller(). ; |
| 53 | -- $line ; |
| 54 | |
| 55 | $string = quotemetascip-perl cpan Compress-Raw-Lzma 2.221 main/quotemeta(). $string; |
| 56 | $file = quotemetascip-perl cpan Compress-Raw-Lzma 2.221 main/quotemeta().($file); |
| 57 | |
| 58 | #return "/$string\\s+at $file line $line/" if $] >= 5.006 ; |
| 59 | return "/$string\\s+at /" ; |
| 60 | } |
| 61 | |
| 62 | sub mkEvalErrscip-perl cpan Compress-Raw-Lzma 2.221 main/mkEvalErr(). |
| 63 | { |
| 64 | my $string = shiftscip-perl cpan Compress-Raw-Lzma 2.221 main/shift(). ; |
| 65 | |
| 66 | return "/$string\\s+at \\(eval /" if $]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. > 5.006 ; |
| 67 | return "/$string\\s+at /" ; |
| 68 | } |
| 69 | |
| 70 | |
| 71 | sub doitscip-perl cpan Compress-Raw-Lzma 2.221 main/doit(). |
| 72 | { |
| 73 | my $compress_class = shiftscip-perl cpan Compress-Raw-Lzma 2.221 main/shift().; |
| 74 | my $uncompress_class = shiftscip-perl cpan Compress-Raw-Lzma 2.221 main/shift().; |
| 75 | |
| 76 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "$compress_class and $uncompress_class"; |
| 77 | |
| 78 | my $hello = <<EOM ; |
| 79 | hello world |
| 80 | this is a test |
| 81 | EOM |
| 82 | |
| 83 | my $len = lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length(). $hello ; |
| 84 | |
| 85 | if (0) |
| 86 | { |
| 87 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "Error Cases" ; |
| 88 | |
| 89 | eval { $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(1,2,3,4,5,6) }; |
| 90 | likescip-perl cpan Compress-Raw-Lzma 2.221 main/like(). $@scip-perl cpan Compress-Raw-Lzma 2.221 main/`$@`., mkErrscip-perl cpan Compress-Raw-Lzma 2.221 main/mkErr(). "Usage: Compress::Raw::Lzma::lzma_alone_encoder(class, appendOut=1)"; |
| 91 | |
| 92 | } |
| 93 | |
| 94 | |
| 95 | if (1) |
| 96 | { |
| 97 | |
| 98 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "lzma - small buffer"; |
| 99 | # ============================== |
| 100 | |
| 101 | my $hello = "I am a HAL 9000 computer" ; |
| 102 | my @hello = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $hello) ; |
| 103 | my ($err, $x, $X, $status); |
| 104 | |
| 105 | ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(); |
| 106 | isa_okscip-perl cpan Compress-Raw-Lzma 2.221 main/isa_ok(). $x, "Compress::Raw::Lzma::Encoder"; |
| 107 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK, "status is LZMA_OK" ; |
| 108 | |
| 109 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->uncompressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/uncompressedBytes().(), 0, "uncompressedBytes() == 0" ; |
| 110 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->compressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/compressedBytes().(), 0, "compressedBytes() == 0" ; |
| 111 | |
| 112 | $X = "" ; |
| 113 | my $Answer = ''; |
| 114 | foreach (@hello) |
| 115 | { |
| 116 | $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $X) ; |
| 117 | last unless $status == LZMA_OK ; |
| 118 | |
| 119 | $Answer .= $X ; |
| 120 | } |
| 121 | |
| 122 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK, "code returned LZMA_OK" ; |
| 123 | |
| 124 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END, "flush returned LZMA_OK" ; |
| 125 | $Answer .= $X ; |
| 126 | |
| 127 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->uncompressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/uncompressedBytes().(), lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length(). $hello, "uncompressedBytes ok" ; |
| 128 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->compressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/compressedBytes().(), lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length(). $Answer, "compressedBytes ok" ; |
| 129 | |
| 130 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END, "flush returned LZMA_STREAM_END"; |
| 131 | $Answer .= $X ; |
| 132 | |
| 133 | #open F, ">/tmp/xx1"; print F $Answer ; close F; |
| 134 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $Answer) ; |
| 135 | |
| 136 | my $k; |
| 137 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0, |
| 138 | ConsumeInput => 0)); |
| 139 | isa_okscip-perl cpan Compress-Raw-Lzma 2.221 main/isa_ok(). $k, "Compress::Raw::Lzma::Decoder" ; |
| 140 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK, "status is LZMA_OK" |
| 141 | or diagscip-perl cpan Compress-Raw-Lzma 2.221 main/diag(). "GOT $err\n"; |
| 142 | |
| 143 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $k->compressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/compressedBytes().(), 0, "compressedBytes() == 0" ; |
| 144 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $k->uncompressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/uncompressedBytes().(), 0, "uncompressedBytes() == 0" ; |
| 145 | my $GOT = ''; |
| 146 | my $Z; |
| 147 | $Z = 1 ;#x 2000 ; |
| 148 | foreach (@Answer) |
| 149 | { |
| 150 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $Z) ; |
| 151 | $GOT .= $Z ; |
| 152 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 153 | |
| 154 | } |
| 155 | |
| 156 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END, "Got LZMA_STREAM_END" ; |
| 157 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $GOT, $hello, "uncompressed data matches ok" ; |
| 158 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $k->compressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/compressedBytes().(), lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length(). $Answer, "compressedBytes ok" ; |
| 159 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $k->uncompressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/uncompressedBytes().(), lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length(). $hello , "uncompressedBytes ok"; |
| 160 | |
| 161 | } |
| 162 | |
| 163 | |
| 164 | if (1) |
| 165 | { |
| 166 | # code/code - small buffer with a number |
| 167 | # ============================== |
| 168 | |
| 169 | my $hello = 6529 ; |
| 170 | |
| 171 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1) ; |
| 172 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x ; |
| 173 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 174 | |
| 175 | my $status; |
| 176 | my $Answer = ''; |
| 177 | |
| 178 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($hello, $Answer), '==', LZMA_OK ; |
| 179 | |
| 180 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($Answer), '==', LZMA_STREAM_END, "flush returned LZMA_STREAM_END"; |
| 181 | |
| 182 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $Answer) ; |
| 183 | |
| 184 | my $k; |
| 185 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 186 | ConsumeInput => 0) ); |
| 187 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 188 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 189 | |
| 190 | #my $GOT = ''; |
| 191 | my $GOT ; |
| 192 | foreach (@Answer) |
| 193 | { |
| 194 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $GOT) ; |
| 195 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 196 | |
| 197 | } |
| 198 | |
| 199 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 200 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $GOT, $hello ; |
| 201 | |
| 202 | } |
| 203 | |
| 204 | if(1) |
| 205 | { |
| 206 | |
| 207 | # code/code options - AppendOutput |
| 208 | # ================================ |
| 209 | |
| 210 | # AppendOutput |
| 211 | # CRC |
| 212 | |
| 213 | my $hello = "I am a HAL 9000 computer" ; |
| 214 | my @hello = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $hello) ; |
| 215 | |
| 216 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1), " Created lzma object" ; |
| 217 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x ; |
| 218 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK, "Status is LZMA_OK" ; |
| 219 | |
| 220 | my $status; |
| 221 | my $X; |
| 222 | foreach (@hello) |
| 223 | { |
| 224 | $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $X) ; |
| 225 | last unless $status == LZMA_OK ; |
| 226 | } |
| 227 | |
| 228 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK ; |
| 229 | |
| 230 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 231 | |
| 232 | |
| 233 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $X) ; |
| 234 | |
| 235 | my $k; |
| 236 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput =>1})); |
| 237 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 238 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 239 | |
| 240 | my $Z; |
| 241 | foreach (@Answer) |
| 242 | { |
| 243 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $Z) ; |
| 244 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 245 | |
| 246 | } |
| 247 | |
| 248 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 249 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $Z, $hello ; |
| 250 | } |
| 251 | |
| 252 | |
| 253 | if(1) |
| 254 | { |
| 255 | |
| 256 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "lzma - larger buffer"; |
| 257 | # ============================== |
| 258 | |
| 259 | # generate a long random string |
| 260 | my $contents = '' ; |
| 261 | foreach (1 .. 50000) |
| 262 | { $contents .= chrscip-perl cpan Compress-Raw-Lzma 2.221 main/chr(). intscip-perl cpan Compress-Raw-Lzma 2.221 main/int(). randscip-perl cpan Compress-Raw-Lzma 2.221 main/rand(). 255 } |
| 263 | |
| 264 | |
| 265 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0) ; |
| 266 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x, " lzma object ok" ; |
| 267 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK," status is LZMA_OK" ; |
| 268 | |
| 269 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->uncompressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/uncompressedBytes().(), 0, " uncompressedBytes() == 0" ; |
| 270 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $x->compressedBytesscip-perl cpan Compress-Raw-Lzma 2.221 main/compressedBytes().(), 0, " compressedBytes() == 0" ; |
| 271 | |
| 272 | my (%X, $Y, %Z, $X, $Z); |
| 273 | #cmp_ok $x->code($contents, $X{key}), '==', LZMA_OK ; |
| 274 | my $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($contents, $X); |
| 275 | #cmp_ok $x->code($contents, $X), '==', LZMA_OK, " compressed ok" ; |
| 276 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK, " compressed ok" ; |
| 277 | |
| 278 | #$Y = $X{key} ; |
| 279 | $Y = $X ; |
| 280 | |
| 281 | |
| 282 | #cmp_ok $x->flush($X{key}), '==', LZMA_OK ; |
| 283 | #$Y .= $X{key} ; |
| 284 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 285 | $Y .= $X ; |
| 286 | |
| 287 | |
| 288 | |
| 289 | my $keep = $Y ; |
| 290 | |
| 291 | my $k; |
| 292 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0, |
| 293 | ConsumeInput => 0) ); |
| 294 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 295 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 296 | |
| 297 | #cmp_ok $k->code($Y, $Z{key}), '==', LZMA_STREAM_END ; |
| 298 | #ok $contents eq $Z{key} ; |
| 299 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($Y, $Z), '==', LZMA_STREAM_END ; |
| 300 | ok $contents eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $Z ; |
| 301 | |
| 302 | # redo deflate with AppendOutput |
| 303 | |
| 304 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). (($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 305 | ConsumeInput => 0)) ; |
| 306 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 307 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 308 | |
| 309 | my $s ; |
| 310 | my $out ; |
| 311 | my @bits = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $keep) ; |
| 312 | foreach my $bit (@bits) { |
| 313 | $s = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($bit, $out) ; |
| 314 | } |
| 315 | |
| 316 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $s, '==', LZMA_STREAM_END ; |
| 317 | |
| 318 | ok $contents eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $out ; |
| 319 | |
| 320 | |
| 321 | } |
| 322 | |
| 323 | |
| 324 | for my $consume ( 0 .. 1) |
| 325 | { |
| 326 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "lzma - check remaining buffer after LZMA_STREAM_END, Consume $consume"; |
| 327 | |
| 328 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0) ; |
| 329 | |
| 330 | my ($X, $Y, $Z); |
| 331 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($hello, $X), '==', LZMA_OK; |
| 332 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($Y), '==', LZMA_STREAM_END; |
| 333 | $X .= $Y ; |
| 334 | |
| 335 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0, |
| 336 | ConsumeInput => $consume) ; |
| 337 | |
| 338 | my $first = substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 0, 2) ; |
| 339 | my $remember_first = $first ; |
| 340 | my $last = substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 2) ; |
| 341 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($first, $Z), '==', LZMA_OK; |
| 342 | if ($consume) { |
| 343 | ok $first eq "" ; |
| 344 | } |
| 345 | else { |
| 346 | ok $first eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $remember_first ; |
| 347 | } |
| 348 | |
| 349 | my $T ; |
| 350 | $last .= "appendage" ; |
| 351 | my $remember_last = $last ; |
| 352 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($last, $T), '==', LZMA_STREAM_END; |
| 353 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $hello, $Z . $T ; |
| 354 | if ($consume) { |
| 355 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $last, "appendage" ; |
| 356 | } |
| 357 | else { |
| 358 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $last, $remember_last ; |
| 359 | } |
| 360 | |
| 361 | } |
| 362 | |
| 363 | |
| 364 | { |
| 365 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). "ConsumeInput and a read-only buffer trapped" ; |
| 366 | |
| 367 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0, |
| 368 | ConsumeInput => 1) ; |
| 369 | |
| 370 | my $Z; |
| 371 | eval { $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().("abc", $Z) ; }; |
| 372 | likescip-perl cpan Compress-Raw-Lzma 2.221 main/like(). $@scip-perl cpan Compress-Raw-Lzma 2.221 main/`$@`., mkErrscip-perl cpan Compress-Raw-Lzma 2.221 main/mkErr().("Compress::Raw::Lzma::Decoder::code input parameter cannot be read-only when ConsumeInput is specified"); |
| 373 | |
| 374 | } |
| 375 | |
| 376 | foreach (1 .. 2) |
| 377 | { |
| 378 | next if $]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. < 5.005 ; |
| 379 | |
| 380 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'test lzma with a substr'; |
| 381 | |
| 382 | my $contents = '' ; |
| 383 | foreach (1 .. 5000) |
| 384 | { $contents .= chrscip-perl cpan Compress-Raw-Lzma 2.221 main/chr(). intscip-perl cpan Compress-Raw-Lzma 2.221 main/int(). randscip-perl cpan Compress-Raw-Lzma 2.221 main/rand(). 255 } |
| 385 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1) ; |
| 386 | |
| 387 | my $X ; |
| 388 | my $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($contents,0), $X); |
| 389 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK ; |
| 390 | |
| 391 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 392 | |
| 393 | my $append = "Appended" ; |
| 394 | $X .= $append ; |
| 395 | |
| 396 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 397 | ConsumeInput => 1) ; |
| 398 | |
| 399 | my $Z; |
| 400 | my $keep = $X ; |
| 401 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 0), $Z) ; |
| 402 | |
| 403 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 404 | #print "status $status X [$X]\n" ; |
| 405 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $contents, $Z ; |
| 406 | ok $X eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $append; |
| 407 | #is length($X), length($append); |
| 408 | #ok $X eq $keep; |
| 409 | #is length($X), length($keep); |
| 410 | } |
| 411 | |
| 412 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'Looping Append test - checks that deRef_l resets the output buffer'; |
| 413 | foreach (1 .. 2) |
| 414 | { |
| 415 | |
| 416 | my $hello = "I am a HAL 9000 computer" ; |
| 417 | my @hello = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $hello) ; |
| 418 | my ($err, $x, $X, $status); |
| 419 | |
| 420 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().( ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 0) ); |
| 421 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x ; |
| 422 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 423 | |
| 424 | $X = "" ; |
| 425 | my $Answer = ''; |
| 426 | foreach (@hello) |
| 427 | { |
| 428 | $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $X) ; |
| 429 | last unless $status == LZMA_OK ; |
| 430 | |
| 431 | $Answer .= $X ; |
| 432 | } |
| 433 | |
| 434 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK ; |
| 435 | |
| 436 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 437 | $Answer .= $X ; |
| 438 | |
| 439 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $Answer) ; |
| 440 | |
| 441 | my $k; |
| 442 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 443 | ConsumeInput => 0) ); |
| 444 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 445 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 446 | |
| 447 | my $GOT ; |
| 448 | my $Z; |
| 449 | $Z = 1 ;#x 2000 ; |
| 450 | foreach (@Answer) |
| 451 | { |
| 452 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., $GOT) ; |
| 453 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 454 | } |
| 455 | |
| 456 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 457 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $GOT, $hello ; |
| 458 | |
| 459 | } |
| 460 | |
| 461 | if ($]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. >= 5.005) |
| 462 | { |
| 463 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'test lzma input parameter via substr'; |
| 464 | |
| 465 | my $hello = "I am a HAL 9000 computer" ; |
| 466 | my $data = $hello ; |
| 467 | |
| 468 | my($X, $Z); |
| 469 | |
| 470 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1); |
| 471 | |
| 472 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($data, $X), '==', LZMA_OK ; |
| 473 | |
| 474 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 475 | |
| 476 | my $append = "Appended" ; |
| 477 | $X .= $append ; |
| 478 | my $keep = $X ; |
| 479 | |
| 480 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( AppendOutput => 1, |
| 481 | ConsumeInput => 1); |
| 482 | |
| 483 | # cmp_ok $k->code(substr($X, 0, -1), $Z), '==', LZMA_STREAM_END ; ; |
| 484 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 0), $Z), '==', LZMA_STREAM_END ; ; |
| 485 | |
| 486 | ok $hello eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $Z ; |
| 487 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $X, $append; |
| 488 | |
| 489 | $X = $keep ; |
| 490 | $Z = ''; |
| 491 | ok $k = $uncompress_class->new( AppendOutput => 1, |
| 492 | ConsumeInput => 0); |
| 493 | |
| 494 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 0, -1), $Z), '==', LZMA_STREAM_END ; ; |
| 495 | #cmp_ok $k->code(substr($X, 0), $Z), '==', LZMA_STREAM_END ; ; |
| 496 | |
| 497 | ok $hello eqscip-perl cpan Compress-Raw-Lzma 2.221 main/eq(). $Z ; |
| 498 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $X, $keep; |
| 499 | |
| 500 | } |
| 501 | |
| 502 | |
| 503 | { |
| 504 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'RT#132734: test inflate append OOK output parameter'; |
| 505 | # https://github.com/pmqs/Compress-Raw-Bzip2/issues/2 |
| 506 | |
| 507 | my $hello = "I am a HAL 9000 computer" ; |
| 508 | my $data = $hello ; |
| 509 | |
| 510 | my($X, $Z); |
| 511 | |
| 512 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput => 1} ); |
| 513 | |
| 514 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($data, $X), '==', LZMA_OK ; |
| 515 | |
| 516 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 517 | |
| 518 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput => 1, |
| 519 | -ConsumeInput => 1} ) ; |
| 520 | $Z = 'prev. ' ; |
| 521 | substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($Z, 0, 4, ''); # chop off first 4 characters using offset |
| 522 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $Z, 'eq', '. ' ; |
| 523 | |
| 524 | # use Devel::Peek ; Dump($Z) ; # shows OOK flag |
| 525 | |
| 526 | # if (1) { # workaround |
| 527 | # my $prev = $Z; |
| 528 | # undef $Z ; |
| 529 | # $Z = $prev ; |
| 530 | # } |
| 531 | |
| 532 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($X, $Z), '==', LZMA_STREAM_END ; |
| 533 | # use Devel::Peek ; Dump($Z) ; # No OOK flag |
| 534 | |
| 535 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $Z, 'eq', ". $hello" ; |
| 536 | } |
| 537 | |
| 538 | |
| 539 | { |
| 540 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'RT#132734: test deflate append OOK output parameter'; |
| 541 | # https://github.com/pmqs/Compress-Raw-Bzip2/issues/2 |
| 542 | |
| 543 | my $hello = "I am a HAL 9000 computer" ; |
| 544 | my $data = $hello ; |
| 545 | |
| 546 | my($X, $Z); |
| 547 | |
| 548 | $X = 'prev. ' ; |
| 549 | substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($X, 0, 6, ''); # chop off all characters using offset |
| 550 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $X, 'eq', '' ; |
| 551 | |
| 552 | # use Devel::Peek ; Dump($X) ; # shows OOK flag |
| 553 | |
| 554 | # if (1) { # workaround |
| 555 | # my $prev = $Z; |
| 556 | # undef $Z ; |
| 557 | # $Z = $prev ; |
| 558 | # } |
| 559 | |
| 560 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( { -AppendOutput => 1 } ); |
| 561 | |
| 562 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($data, $X), '==', LZMA_OK ; |
| 563 | |
| 564 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($X), '==', LZMA_STREAM_END ; |
| 565 | |
| 566 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput => 1, |
| 567 | -ConsumeInput => 1} ) ; |
| 568 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($X, $Z), '==', LZMA_STREAM_END ; |
| 569 | |
| 570 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $Z, $hello ; |
| 571 | } |
| 572 | |
| 573 | |
| 574 | { |
| 575 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'RT#132734: test flush append OOK output parameter'; |
| 576 | # https://github.com/pmqs/Compress-Raw-Bzip2/issues/2 |
| 577 | |
| 578 | my $hello = "I am a HAL 9000 computer" ; |
| 579 | my $data = $hello ; |
| 580 | |
| 581 | my($X, $Z); |
| 582 | |
| 583 | my $F = 'prev. ' ; |
| 584 | substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($F, 0, 6, ''); # chop off all characters using offset |
| 585 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $F, 'eq', '' ; |
| 586 | |
| 587 | # use Devel::Peek ; Dump($F) ; # shows OOK flag |
| 588 | |
| 589 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $x = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput => 1 }); |
| 590 | |
| 591 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($data, $X), '==', LZMA_OK ; |
| 592 | |
| 593 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().($F), '==', LZMA_STREAM_END ; |
| 594 | |
| 595 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). my $k = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().( {-AppendOutput => 1, |
| 596 | -ConsumeInput => 1} ) ; |
| 597 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($X . $F, $Z), '==', LZMA_STREAM_END ; |
| 598 | |
| 599 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $Z, $hello ; |
| 600 | } |
| 601 | |
| 602 | exitscip-perl cpan Compress-Raw-Lzma 2.221 main/exit(). if $]scip-perl cpan Compress-Raw-Lzma 2.221 main/`$]`. < 5.006 ; |
| 603 | |
| 604 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'Looping Append test with substr output - substr the end of the string'; |
| 605 | foreach (1 .. 2) |
| 606 | { |
| 607 | |
| 608 | my $hello = "I am a HAL 9000 computer" ; |
| 609 | my @hello = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $hello) ; |
| 610 | my ($err, $x, $X, $status); |
| 611 | |
| 612 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().( ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new(). (AppendOutput => 1) ); |
| 613 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x ; |
| 614 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 615 | |
| 616 | $X = "" ; |
| 617 | my $Answer = ''; |
| 618 | foreach (@hello) |
| 619 | { |
| 620 | $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($Answer, lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length().($Answer))) ; |
| 621 | last unless $status == LZMA_OK ; |
| 622 | |
| 623 | } |
| 624 | |
| 625 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK ; |
| 626 | |
| 627 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($Answer, lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length().($Answer))), '==', LZMA_STREAM_END ; |
| 628 | |
| 629 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $Answer) ; |
| 630 | |
| 631 | my $k; |
| 632 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 633 | ConsumeInput => 0) ); |
| 634 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 635 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 636 | |
| 637 | my $GOT = ''; |
| 638 | my $Z; |
| 639 | $Z = 1 ;#x 2000 ; |
| 640 | foreach (@Answer) |
| 641 | { |
| 642 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($GOT, lengthscip-perl cpan Compress-Raw-Lzma 2.221 main/length().($GOT))) ; |
| 643 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 644 | } |
| 645 | |
| 646 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 647 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $GOT, $hello ; |
| 648 | |
| 649 | } |
| 650 | |
| 651 | titlescip-perl cpan Compress-Raw-Lzma 2.221 main/title(). 'Looping Append test with substr output - substr the complete string'; |
| 652 | foreach (1 .. 2) |
| 653 | { |
| 654 | |
| 655 | my $hello = "I am a HAL 9000 computer" ; |
| 656 | my @hello = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $hello) ; |
| 657 | my ($err, $x, $X, $status); |
| 658 | |
| 659 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().( ($x, $err) = $compress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new(). (AppendOutput => 1) ); |
| 660 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $x ; |
| 661 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 662 | |
| 663 | $X = "" ; |
| 664 | my $Answer = ''; |
| 665 | foreach (@hello) |
| 666 | { |
| 667 | $status = $x->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($Answer, 0)) ; |
| 668 | last unless $status == LZMA_OK ; |
| 669 | |
| 670 | } |
| 671 | |
| 672 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_OK ; |
| 673 | |
| 674 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $x->flushscip-perl cpan Compress-Raw-Lzma 2.221 main/flush().(substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($Answer, 0)), '==', LZMA_STREAM_END ; |
| 675 | |
| 676 | my @Answer = splitscip-perl cpan Compress-Raw-Lzma 2.221 main/split().('', $Answer) ; |
| 677 | |
| 678 | # append, consume, limit |
| 679 | my $k; |
| 680 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok().(($k, $err) = $uncompress_class->newscip-perl cpan Compress-Raw-Lzma 2.221 main/new().(AppendOutput => 1, |
| 681 | ConsumeInput => 0) ); |
| 682 | okscip-perl cpan Compress-Raw-Lzma 2.221 main/ok(). $k ; |
| 683 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $err, '==', LZMA_OK ; |
| 684 | |
| 685 | my $GOT = ''; |
| 686 | my $Z; |
| 687 | $Z = 1 ;#x 2000 ; |
| 688 | foreach (@Answer) |
| 689 | { |
| 690 | $status = $k->codescip-perl cpan Compress-Raw-Lzma 2.221 main/code().($_scip-perl cpan Compress-Raw-Lzma 2.221 main/$_., substrscip-perl cpan Compress-Raw-Lzma 2.221 main/substr().($GOT, 0)) ; |
| 691 | last if $status == LZMA_STREAM_END or $status != LZMA_OK ; |
| 692 | } |
| 693 | |
| 694 | cmp_okscip-perl cpan Compress-Raw-Lzma 2.221 main/cmp_ok(). $status, '==', LZMA_STREAM_END ; |
| 695 | isscip-perl cpan Compress-Raw-Lzma 2.221 main/is(). $GOT, $hello ; |
| 696 | } |
| 697 | |
| 698 | } |
| 699 | |
| 700 | for my $class ([qw(AloneEncoder AloneDecoder)], |
| 701 | [qw(StreamEncoder StreamDecoder)], |
| 702 | [qw(RawEncoder RawDecoder)] , |
| 703 | [qw(EasyEncoder AutoDecoder)] , |
| 704 | ) |
| 705 | { |
| 706 | my $c = "Compress::Raw::Lzma::" . $class->[0]; |
| 707 | my $u = "Compress::Raw::Lzma::" . $class->[1]; |
| 708 | doitscip-perl cpan Compress-Raw-Lzma 2.221 main/doit(). $c, $u; |
| 709 | } |