[project @ 5843]
[audio-mpd.git] / t / 10-status.t
blobe5067ac837bd4043746a0aee7d2beed2a5b58de9
1 #!perl
3 # This file is part of Audio::MPD.
4 # Copyright (c) 2007 Jerome Quelin <jquelin@cpan.org>
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or (at
9 # your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 use strict;
23 use warnings;
25 use Audio::MPD::Status;
26 use Test::More tests => 14;
29 # note that the first line does not match 'key: value' pattern
30 # and has been added for the sake of testing. :-)
31 my %kv = (
32     volume         => 66,
33     repeat         => 1,
34     random         => 0,
35     playlist       => 24,
36     playlistlength => 21,
37     xfade          => 14,
38     state          => 'play',
39     song           => 10,
40     songid         => 11,
41     time           => '45:214',
42     bitrate        => 127,
43     audio          => '44100:16:2',
44     error          => 'problems opening audio device',
47 my $s = Audio::MPD::Status->new( %kv );
48 isa_ok( $s, 'Audio::MPD::Status', 'object creation' );
49 is( $s->volume,         66,                              'accessor: volume' );
50 is( $s->repeat,         1,                               'accessor: repeat' );
51 is( $s->random,         0,                               'accessor: random' );
52 is( $s->playlist,       24,                              'accessor: playlist' );
53 is( $s->playlistlength, 21,                              'accessor: playlistlength' );
54 is( $s->xfade,          14,                              'accessor: xfade' );
55 is( $s->state,          'play',                          'accessor: state' );
56 is( $s->song,           10,                              'accessor: song' );
57 is( $s->songid,         11,                              'accessor: songid' );
58 is( $s->time,           '45:214',                        'accessor: time' );
59 is( $s->bitrate,        127,                             'accessor: bitrate' );
60 is( $s->audio,          '44100:16:2',                    'accessor: audio' );
61 is( $s->error,          'problems opening audio device', 'accessor: error' );