File: 10.read.t

package info (click to toggle)
libdevice-cdio-perl 0.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,248 kB
  • ctags: 2,564
  • sloc: ansic: 11,536; perl: 4,027; makefile: 69; sh: 3
file content (40 lines) | stat: -rwxr-xr-x 1,097 bytes parent folder | download | duplicates (5)
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
#!/usr/bin/env perl
# Test functioning of read routines

use strict;
use warnings;

BEGIN {
    chdir 't' if -d 't';
}
use lib '../lib';
use blib;

use Device::Cdio::Device;
use Test::More tests => 6;
note "Test functioning of read routines";

use Cwd;
my $cuefile= Cwd::abs_path("../data/isofs-m1.cue");
my $device = Device::Cdio::Device->new(-source=>$cuefile);

# Read the ISO Primary Volume descriptor

my($data, $size, $drc) = 
    $device->read_sectors(16, $perlcdio::READ_MODE_M1F1);

ok(substr($data, 1, 5) eq 'CD001' 
   && $perlcdio::M2RAW_SECTOR_SIZE == length($data),
   "Mode 1 Format 1 reading");

ok(substr($data, 2328, 2) eq "\0\0", "Mode 1 Format 1 reading - null bytes");

my $data2 = $device->read_sectors(16, $perlcdio::READ_MODE_M1F1, 1);
ok($data2 eq $data, "Mode 1 reading with block parameter");

my $data3 = $device->read_data_blocks(16, 1);
ok($data2 eq $data, "Mode 1 reading matches data reading (block parameter)");

($data, $size, $drc) = $device->read_data_blocks(26);
ok(substr($data, 6, 26) eq 'GNU GENERAL PUBLIC LICENSE');
ok($size == $perlcdio::ISO_BLOCKSIZE);