D64-Disk-Dir-Item

 view release on metacpan or  search on metacpan

t/03-set.t  view on Meta::CPAN

    throws_ok(
        sub { $item->type(ord ($T_PRG) | 0b11110000); },
        qr/\QInvalid file type constant (only bits 0-3 can be set)\E/,
        'set partially invalid type value for a valid directory item',
    );
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->type('$T_PRG'); },
        qr/\QInvalid file type constant (type constant expected)\E/,
        'set invalid type length for a valid directory item',
    );
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->type([$T_PRG]); },
        qr/\QInvalid file type constant (scalar value expected)\E/,
        'set invalid type type for a valid directory item',
    );
}
########################################
{
    my $item = $class->new();
    $item->closed(1);
    ok($item->closed(), 'set closed flag for an empty directory item');
}
########################################
{
    my $item = $class->new();
    $item->closed(0);
    ok(!$item->closed(), 'clear closed flag for an empty directory item');
}
########################################
{
    my $item = get_item();
    $item->closed(1);
    ok($item->closed(), 'set closed flag for a valid directory item');
}
########################################
{
    my $item = get_item();
    $item->closed(0);
    ok(!$item->closed(), 'clear closed flag for a valid directory item');
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->closed([1]); },
        qr/Invalid "closed" flag/,
        'set invalid closed flag for a valid directory item',
    );
}
########################################
{
    my $item = $class->new();
    $item->locked(1);
    ok($item->locked(), 'set locked flag for an empty directory item');
}
########################################
{
    my $item = $class->new();
    $item->locked(0);
    ok(!$item->locked(), 'clear locked flag for an empty directory item');
}
########################################
{
    my $item = get_item();
    $item->locked(1);
    ok($item->locked(), 'set locked flag for a valid directory item');
}
########################################
{
    my $item = get_item();
    $item->locked(0);
    ok(!$item->locked(), 'clear locked flag for a valid directory item');
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->locked([1]); },
        qr/Invalid "locked" flag/,
        'set invalid locked flag for a valid directory item',
    );
}
########################################
{
    my $item = $class->new();
    my $track = 0x11;
    $item->track($track);
    is($item->track(), $track, 'set new track location of first sector of file for an empty directory item');
}
########################################
{
    my $item = get_item();
    my $track = 0x13;
    $item->track($track);
    is($item->track(), $track, 'set new track location of first sector of file for a valid directory item');
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->track(0x0100); },
        qr/\QInvalid value (256) of track location of first sector of file (single byte expected)\E/,
        'set non-byte track location of first sector of file for a valid directory item',
    );
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->track('0x13'); },
        qr/\QInvalid value ('0x13') of track location of first sector of file (single byte expected)\E/,
        'set non-numeric track location of first sector of file for a valid directory item',
    );
}
########################################
{
    my $item = get_item();
    throws_ok(
        sub { $item->track([0x13]); },
        qr/\QInvalid type ([19]) of track location of first sector of file (single byte expected)\E/,
        'set non-scalar track location of first sector of file for a valid directory item',
    );
}
########################################
{
    my $item = $class->new();
    my $sector = 0x03;
    $item->sector($sector);
    is($item->sector(), $sector, 'set new sector location of first sector of file for an empty directory item');
}
########################################
{
    my $item = get_item();
    my $sector = 0x07;
    $item->sector($sector);
    is($item->sector(), $sector, 'set new sector location of first sector of file for a valid directory item');
}
########################################
{
    my $item = get_item();



( run in 0.446 second using v1.01-cache-2.11-cpan-2c0d6866c4f )