Skip to content

Commit

Permalink
Merge branch 'master' into working
Browse files Browse the repository at this point in the history
  • Loading branch information
mtalexander committed Feb 21, 2015
2 parents e183368 + e85cc57 commit 1328841
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 46 deletions.
3 changes: 2 additions & 1 deletion htdocs/developer.html
@@ -1,4 +1,5 @@
<html>

<head>
<title>Finance::Quote Homepage</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
Expand Down Expand Up @@ -90,7 +91,7 @@ <h2 align="center">Git</h2>
<p>Anonymous access to the development branch is available
for those wishing to use the development branch of Finance::Quote.
Details on anonymous Git access can be found
<a href="http://github.com/pjf/finance-quote">here</a>.</p>
<a href="http://github.com/finance-quote/finance-quote">here</a>.</p>

<h2 align="center">CVS</h2>
<p>The development repository has been ported to Git.
Expand Down
64 changes: 19 additions & 45 deletions t/tiaacref.t
Expand Up @@ -7,55 +7,29 @@ if (not $ENV{ONLINE_TEST}) {
plan skip_all => 'Set $ENV{ONLINE_TEST} to run this test';
}

plan tests => 27;
plan tests => 45;

# Test TIAA-CREF functions.

my $q = Finance::Quote->new();
my $year = (localtime())[5] + 1900;
my $lastyear = $year - 1;

my %quotes = $q->tiaacref_direct("CREFmony","TIAAreal","TLSRX","TCMVX","TLGRX","BOGOname","CREFbond");
ok(%quotes);

ok($quotes{"CREFmony","nav"} > 0);
ok($quotes{"CREFmony", "currency"} eq "USD");
ok(length($quotes{"CREFmony","date"}) > 0);
ok(substr($quotes{"CREFmony","isodate"},0,4) == $year ||
substr($quotes{"CREFmony","isodate"},0,4) == $lastyear);
ok(substr($quotes{"CREFmony","date"},6,4) == $year ||
substr($quotes{"CREFmony","date"},6,4) == $lastyear);

ok($quotes{"TIAAreal","nav"} > 0);
ok(length($quotes{"TIAAreal","date"}) > 0);
ok(substr($quotes{"TIAAreal","isodate"},0,4) == $year ||
substr($quotes{"TIAAreal","isodate"},0,4) == $lastyear);
ok(substr($quotes{"TIAAreal","date"},6,4) == $year ||
substr($quotes{"TIAAreal","date"},6,4) == $lastyear);

ok($quotes{"TLSRX","success"} > 0);
ok($quotes{"TLSRX","nav"} > 0);
ok(length($quotes{"TLSRX","date"}) > 0);
ok(substr($quotes{"TLSRX","isodate"},0,4) == $year ||
substr($quotes{"TLSRX","isodate"},0,4) == $lastyear);
ok(substr($quotes{"TLSRX","date"},6,4) == $year ||
substr($quotes{"TLSRX","date"},6,4) == $lastyear);

ok($quotes{"TCMVX","success"} > 0);
ok($quotes{"TCMVX","nav"} > 0);
ok(length($quotes{"TCMVX","date"}) > 0);
ok(substr($quotes{"TCMVX","isodate"},0,4) == $year ||
substr($quotes{"TCMVX","isodate"},0,4) == $lastyear);
ok(substr($quotes{"TCMVX","date"},6,4) == $year ||
substr($quotes{"TCMVX","date"},6,4) == $lastyear);

ok($quotes{"TLGRX","success"} > 0);

ok($quotes{"BOGOname","success"} == 0);
ok($quotes{"BOGOname","errormsg"} eq "Bad symbol");

ok($quotes{"CREFbond","success"} > 0);
ok($quotes{"CREFbond","nav"} > 0);
ok($quotes{"CREFbond", "currency"} eq "USD");
ok(substr($quotes{"CREFbond","date"},6,4) == $year ||
substr($quotes{"CREFbond","date"},6,4) == $lastyear);
my @symbols = qw / CREFmony TIAAreal TLSRX TCMVX TLGRX CREFbond /;
my %quotes = $q->tiaacref_direct(@symbols,"BOGOname");
ok(%quotes,"quotes got retrieved");

foreach my $symbol (@symbols) {
ok($quotes{$symbol,"success"} > 0,"$symbol got retrieved");
ok($quotes{$symbol,"nav"} > 0,"$symbol has a nav");
ok($quotes{$symbol, "currency"} eq "USD","$symbol currency is valid");
ok($quotes{$symbol,"price"} > 0,"$symbol price (".$quotes{$symbol,"price"}.")> 0");
ok(length($quotes{$symbol,"date"}) > 0,"$symbol has a valid date : ".$quotes{$symbol,"date"});
ok(substr($quotes{$symbol,"isodate"},0,4) == $year ||
substr($quotes{$symbol,"isodate"},0,4) == $lastyear,"$symbol isodate is recent");
ok(substr($quotes{$symbol,"date"},6,4) == $year ||
substr($quotes{$symbol,"date"},6,4) == $lastyear,"$symbol date is recent");
};

ok($quotes{"BOGOname","success"} == 0,"BOGUS failed");
ok($quotes{"BOGOname","errormsg"} eq "Bad symbol","BOGUS returned errornsg");

0 comments on commit 1328841

Please sign in to comment.