#!/usr/bin/perl -w
if
(not
$ENV
{ONLINE_TEST}) {
plan
skip_all
=>
'Set $ENV{ONLINE_TEST} to run this test'
;
}
plan
tests
=> 9 * 2;
my
(
$year
,
$month
,
$day
) = Today();
my
$q
= Finance::Quote->new();
my
@funds
= (
"2009100101"
,
"2002013108"
);
my
%info
=
$q
->morningstarjp(
@funds
);
ok(
%info
);
foreach
my
$fund
(
@funds
)
{
my
$fndyear
=
substr
(
$info
{
$fund
,
"isodate"
}, 0, 4 );
my
$fndmonth
=
substr
(
$info
{
$fund
,
"isodate"
}, 5, 2 );
my
$fndday
=
substr
(
$info
{
$fund
,
"isodate"
}, 8, 2 );
cmp_ok( Delta_Days(
$fndyear
,
$fndmonth
,
$fndday
,
$year
,
$month
,
$day
),
'<='
, 11,
'not more than 11 days before today'
);
cmp_ok( Delta_Days(
$fndyear
,
$fndmonth
,
$fndday
,
$year
,
$month
,
$day
),
'>='
, -1,
'not more than 1 day in the future'
);
cmp_ok(
$info
{
$fund
,
'currency'
},
'eq'
,
'JPY'
,
'currency'
);
cmp_ok(
$info
{
$fund
,
'method'
},
'eq'
,
'MorningstarJP'
,
'method'
);
cmp_ok(
$info
{
$fund
,
'name'
},
'eq'
,
$fund
,
'name'
);
cmp_ok(
$info
{
$fund
,
"nav"
},
'>'
, 0,
'nav'
);
ok(
$info
{
$fund
,
"success"
},
'success'
);
cmp_ok(
$info
{
$fund
,
'symbol'
},
'eq'
,
$fund
,
'symbol'
);
}
ok( !
$info
{
"BOGUS"
,
"success"
} );