Debian Codegraph @

t/02-basic.t

raw
1 # much of this test code is blatently ripped out of the test code from
2 # Ogg::Vorbis::Header.
3 # This is in part due to laziness and in part to try to ensure the
4 # two modules share the same API.
5
6 #########################
7
8 # change 'tests => 1' to 'tests => last_test_to_print';
9
10 use strict;
11 use warnings;
12
13 use Test::More;
14 use Ogg::Vorbis::Header::PurePerl;
15
16 #########################
17
18 # See if partial load works
19 ok(my $ogg = Ogg::Vorbis::Header::PurePerl->new('t/test.ogg'));
20
21 # Try all the routines
22 is($ogg->info->{'rate'}, 44_100, 'Got rate from hash');
23 is($ogg->info('rate'), 44_100, 'Got rate from subroutine');
24 ok($ogg->comment_tags, 'Got comment tags');
25 is($ogg->comment('artist'), 'maloi', 'Got artist');
26 is($ogg->path, 't/test.ogg', 'Got path');
27
28 my @artists = $ogg->comment('artist');
29 is(@artists, 1, 'Correct number of artists');
30 is($artists[0], 'maloi', 'Correct artist');
31
32 $ogg = 0;
33
34 # See if full load works
35 ok($ogg = Ogg::Vorbis::Header::PurePerl->new('t/test.ogg'),
36 'Got an object');
37 isa_ok($ogg, 'Ogg::Vorbis::Header::PurePerl');
38 is($ogg->comment('artist'), 'maloi', 'Got artist again');
39
40 # and see if we can get comments including the '=' character
41 is($ogg->comment('album'), 'this=that', 'Got title');
42
43 # Make sure we're getting the right track length
44 is($ogg->info->{'length'}, 0, 'Got length');
45
46 done_testing();