#!/usr/bin/perl -w
if
(not
$ENV
{ONLINE_TEST}) {
plan
skip_all
=>
'Set $ENV{ONLINE_TEST} to run this test'
;
}
plan
tests
=> 14;
my
$q
= Finance::Quote->new();
my
@stocks
= (
"NOK1V"
,
"RTRKS"
);
my
$year
= (
localtime
())[5] + 1900;
my
$lastyear
=
$year
- 1;
my
%quotes
=
$q
->fetch(
"hex"
,
@stocks
);
ok(
%quotes
);
foreach
my
$stock
(
@stocks
) {
ok(
$quotes
{
$stock
,
"price"
} > 0);
ok(
length
(
$quotes
{
$stock
,
"name"
}));
ok(
$quotes
{
$stock
,
"success"
});
ok(
$quotes
{
$stock
,
"currency"
} eq
"EUR"
);
ok(
substr
(
$quotes
{
$stock
,
"isodate"
},0,4) ==
$year
||
substr
(
$quotes
{
$stock
,
"isodate"
},0,4) ==
$lastyear
);
ok(
substr
(
$quotes
{
$stock
,
"date"
},6,4) ==
$year
||
substr
(
$quotes
{
$stock
,
"date"
},6,4) ==
$lastyear
);
}
%quotes
=
$q
->fetch(
"hex"
,
"BOGUS"
);
ok(!
$quotes
{
"BOGUS"
,
"success"
});