Debian Codegraph @

t/union.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 => 7;
11
12 # Test TD Waterhouse functions.
13
14 my $q = Finance::Quote->new();
15
16 my %quotes = $q->unionfunds("DE0008491002","12345");
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{"DE0008491002","last"} > 0);
22 ok($quotes{"DE0008491002","success"});
23 ok($quotes{"DE0008491002", "currency"} eq "EUR");
24
25 my $year = (localtime())[5] + 1900;
26 my $lastyear = $year - 1;
27 ok(substr($quotes{"DE0008491002","isodate"},0,4) eq $year ||
28 substr($quotes{"DE0008491002","isodate"},0,4) eq $lastyear);
29 ok(substr($quotes{"DE0008491002","date"},6,4) eq $year ||
30 substr($quotes{"DE0008491002","date"},6,4) eq $lastyear);
31
32
33 # Check that bogus stocks return failure:
34
35 ok(! $quotes{"12345","success"});