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 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#####################################################################
#
# Test suite for 'Weather::Com::AirPressure'
#
# Before `make install' is performed this script should be runnable
# with `make test'. After `make install' it should work as
# `perl t/AirPressure.t'
#
#####################################################################
#
# initialization
#
no warnings;
use Test::More tests => 11;
BEGIN {
use_ok('Weather::Com::AirPressure');
}
#####################################################################
#
# Testing object instantiation (do we use the right class)?
#
my $bar = Weather::Com::AirPressure->new();
isa_ok( $bar, "Weather::Com::AirPressure", 'Right class?' );
isa_ok( $bar, "Weather::Com::Object", 'Right inheritance?' );
#
# Test negative init when instantiated without arguments
#
is( $bar->pressure, -1, 'Test negative initialization of pressure.' );
is( $bar->tendency(), 'unknown', 'Test negative initialization of tendency.' );
#
# Test negative init when instantiated for German
#
$bar = Weather::Com::AirPressure->new( lang => 'de' );
is( $bar->pressure, -1, 'Test negative initialization of pressure.' );
is( $bar->tendency(), 'unbekannt',
'Test negative initialization of tendency.' );
#
# Test negative update
#
$bar->update( 'r' => undef,
'd' => undef, );
is( $bar->pressure, -1, 'Test negative update of pressure.' );
is( $bar->tendency(), 'unbekannt', 'Test negative update of tendency.' );
#
# Test positive update
#
$bar->update(
'r' => '1,100',
'd' => 'steady'
);
is( $bar->pressure, '1,100', 'Test update of pressure.' );
is( $bar->tendency(), 'stabil', 'Test update of tendency.' );
|