Debian Codegraph @

t/ukfunds.t

raw
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 => 8;
11
12 my $q = Finance::Quote->new();
13 my $year = (localtime())[5] + 1900;
14 my $lastyear = $year - 1;
15
16 my %quotes = $q->ukfunds("GB0031835118","GB0030880032","LU0116926998","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{"GB0031835118","last"} > 0);
22 ok($quotes{"GB0031835118","success"});
23
24 ok($quotes{"GB0030880032","last"} > 0);
25 ok($quotes{"GB0030880032","success"});
26
27 ok($quotes{"LU0116926998","last"} > 0);
28 ok($quotes{"LU0116926998","success"});
29
30 # Check that bogus stocks return failure:
31
32 ok(! $quotes{"BOGUS","success"});