Permalink
Browse files

updated tests

  • Loading branch information...
1 parent 4a524aa commit f5034261d140ae79b8d2e4d059b828e18595689a @barbie committed Jan 29, 2012
Showing with 27 additions and 15 deletions.
  1. +2 −2 t/05setup_db-cpanstats.t
  2. +7 −1 t/51init.t
  3. +9 −9 t/52methods-graphs.t
  4. +1 −1 t/56writes.t
  5. +8 −2 t/CTWS_Testing.pm
  6. BIN t/expected.zip
View
@@ -34,8 +34,8 @@ $dbh->do(q{
# calculate dates
my @date = localtime(time);
-my $THISMONTH = sprintf "%04d%02d", $date[5]+1900, $date[4]+1;
-my $LASTMONTH = sprintf "%04d%02d", $date[4] ? ($date[5]+1900, $date[4]) : ($date[5]+1899, 12);
+my $THISMONTH = sprintf "%04d%02d", $date[4] > 0 ? ($date[5]+1900, $date[4]) : ($date[5]+1899, 12);
+my $LASTMONTH = sprintf "%04d%02d", $date[4] > 1 ? ($date[5]+1900, $date[4]-1) : ($date[5]+1899, 11 + $date[4]);
while(<DATA>){
next unless(/^\d/);
View
@@ -4,7 +4,7 @@ use strict;
use warnings;
$|=1;
-use Test::More tests => 17;
+use Test::More tests => 20;
use File::Spec;
use lib 't';
use CTWS_Testing;
@@ -44,3 +44,9 @@ is($page->{dates}{THISMONTH}, $date1, '..this month');
is($page->{dates}{LASTMONTH}, $date2, '..last month');
is($page->{dates}{THATMONTH}, $date3, '..previous month');
+my @full_range = ( '00000000-99999999' );
+my @test_range = ( '199901-200412', '200301-200712', '200601-201012', "200901-$page->{dates}{LASTMONTH}" );
+
+is($obj->ranges(), undef, '.. no range');
+is_deeply($obj->ranges('NONE'), \@full_range, '.. single full range');
+is_deeply($obj->ranges('TEST_RANGES'), \@test_range, '.. list of ranges');
View
@@ -7,17 +7,17 @@ use Test::More tests => 16;
use CPAN::Testers::WWW::Statistics::Graphs;
my @ranges = (
- { min => 1, max => 9, smax => 10, steps => '1|2|3|4|5|6|7|8|9' },
- { min => 10, max => 90, smax => 90, steps => '10|20|30|40|50|60|70|80|90' },
- { min => 100, max => 300, smax => 300, steps => '100|150|200|250|300' },
- { min => 400, max => 600, smax => 600, steps => '400|450|500|550|600' },
- { min => 4000, max => 6000, smax => 6000, steps => '4k|4.5k|5k|5.5k|6k' },
- { min => 40000, max => 64000, smax => 65000, steps => '40k|45k|50k|55k|60k|65k' },
- { min => 400000, max => 690000, smax => 700000, steps => '400k|450k|500k|550k|600k|650k|700k' },
- { min => 4000000, max => 6900000, smax => 10000000, steps => '4m|5m|6m|7m' },
+ { min => 1, max => 9, smax => 10, steps => '1|2|3|4|5|6|7|8|9' },
+ { min => 10, max => 90, smax => 90, steps => '10|20|30|40|50|60|70|80|90' },
+ { min => 100, max => 300, smax => 300, steps => '100|150|200|250|300' },
+ { min => 400, max => 600, smax => 600, steps => '400|500|600' },
+ { min => 4000, max => 6000, smax => 6000, steps => '4k|5k|6k' },
+ { min => 40000, max => 64000, smax => 70000, steps => '40k|50k|60k|70k' },
+ { min => 400000, max => 690000, smax => 800000, steps => '400k|500k|600k|700k' },
+ { min => 4000000, max => 6900000, smax => 8000000, steps => '4m|5m|6m|7m' },
);
for my $r (@ranges) {
is(CPAN::Testers::WWW::Statistics::Graphs::_set_max($r->{max}),$r->{smax}, "max matches: $r->{max}");
is(CPAN::Testers::WWW::Statistics::Graphs::_set_range($r->{min},$r->{max}),$r->{steps}, "range matches: $r->{min}");
-}
+}
View
@@ -23,7 +23,7 @@ my $CHECK_DOMAIN = 'www.google.com';
my $UPDATE_ARCHIVE = ($ARGV[0] && $ARGV[0] eq '--update-archive') ? 1 : 0;
-use Test::More tests => 270;
+use Test::More tests => 290;
use Test::Differences;
use File::Slurp qw( slurp );
use Archive::Zip;
View
@@ -125,16 +125,22 @@ cgi-bin/cpanmail.cgi
favicon.ico
HERE
+[TOLINK]
+cgi-bin/response.html=response.html
+
[TEST_RANGES]
LIST=<<HERE
199901-200412
200301-200712
-200601-200912
+200601-201012
+200901-201312
HERE
[CPAN_RANGES]
LIST=<<HERE
+199501-199812
199901-200412
200301-200712
-200601-200912
+200601-201012
+200901-201312
HERE
View
Binary file not shown.

0 comments on commit f503426

Please sign in to comment.