summaryrefslogtreecommitdiff
path: root/t/tests/model/music-file.t
blob: 845a88dfec6d9f7cbe34543dcc4de628342d66f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use v6.d.PREVIEW;
use Test;
use Ultramarine::Model::MusicFile;
 
# test file generated with: 
# avconv -ac 2 -ar 44100 -f s16le -i /dev/zero -t 1 -q 0 -metadata title="some title" -metadata artist="some artist" test.mp3 
 
# this way we test that MusicFile passes a usable path to avprobe, not 
# just the .Str 
my $path = IO::Path.new('test.mp3',:CWD('t/data/'));
my Ultramarine::Model::MusicFile $mf .= new(:$path);
my %data = $mf.metadata;
 
is-approx(%data<bit_rate>.Num,33633,:1abs-tol,'bit rate should match');
is-approx(%data<duration>.Num,1,:1abs-tol,'length should match');
is(%data<format_name>,'mp3','format should match');
is(%data<tags><artist>,'some artist','artist should match');
is(%data<tags><title>,'some title','title should match');
 
done-testing;