| 1 |
#!/usr/bin/perl -w |
| 2 |
use strict; |
| 3 |
use Test::More; |
| 4 |
use Finance::Quote; |
| 5 |
|
| 6 |
if (not $ENV{ONLINE_TEST}) { |
| 7 |
plan skip_all => 'Set $ENV{ONLINE_TEST} to run this test'; |
| 8 |
} |
| 9 |
|
| 10 |
plan tests => 12; |
| 11 |
|
| 12 |
my $q = Finance::Quote->new(); |
| 13 |
my $year = (localtime())[5] + 1900; |
| 14 |
my $lastyear = $year - 1; |
| 15 |
|
| 16 |
my %quotes = $q->ftfunds("GB0031293995","GB0030366719","GB0003865176","GB00B7W6PR65","BOGUS"); |
| 17 |
ok(%quotes); |
| 18 |
|
| 19 |
# Check the last values are defined. These are the most |
| 20 |
# used and most reliable indicators of success. |
| 21 |
ok($quotes{"GB0031293995","last"} > 0); |
| 22 |
ok($quotes{"GB0031293995","success"}); |
| 23 |
|
| 24 |
ok($quotes{"GB00B7W6PR65","last"} > 0); |
| 25 |
ok($quotes{"GB00B7W6PR65","success"}); |
| 26 |
ok($quotes{"GB00B7W6PR65","currency"} eq "GBP", "Currency (GBP) for GB00B7W6PR65 is ".$quotes{"GB00B7W6PR65","currency"}); |
| 27 |
ok($quotes{"GB00B7W6PR65","price"}<100,"Price for GB00B7W6PR65 < 100 : ".$quotes{"GB00B7W6PR65","price"}); |
| 28 |
|
| 29 |
ok($quotes{"GB0030366719","last"} > 0); |
| 30 |
ok($quotes{"GB0030366719","success"}); |
| 31 |
|
| 32 |
ok($quotes{"GB0003865176","last"} > 0); |
| 33 |
ok($quotes{"GB0003865176","success"}); |
| 34 |
|
| 35 |
# Check that bogus stocks return failure: |
| 36 |
|
| 37 |
ok(! $quotes{"BOGUS","success"}); |