From dae54add2dabb32aa1faf534cde9443eba59fca7 Mon Sep 17 00:00:00 2001 From: Frank Thomas Tveter Date: Wed, 3 May 2017 09:32:30 +0200 Subject: [PATCH 1/2] Delete 01-JulianDay_Epoch.t --- astro/src/astro/perl/t/01-JulianDay_Epoch.t | 23 --------------------- 1 file changed, 23 deletions(-) delete mode 100644 astro/src/astro/perl/t/01-JulianDay_Epoch.t diff --git a/astro/src/astro/perl/t/01-JulianDay_Epoch.t b/astro/src/astro/perl/t/01-JulianDay_Epoch.t deleted file mode 100644 index c9fe54c..0000000 --- a/astro/src/astro/perl/t/01-JulianDay_Epoch.t +++ /dev/null @@ -1,23 +0,0 @@ -use Test::More tests => 17; -use Time::Local qw(timegm); -BEGIN { use_ok( 'Metno::Astro::AlmanacAlgorithm', ':all'); } - -my %julianDays = ( - 2451545.125 => [2000, 1, 1, 15], - 2451179.5 => [1999, 1, 1, 0], - 2446822.5 => [1987, 1, 27, 0], - 2446966.0 => [1987, 6, 19, 12], - 2447187.5 => [1988, 1, 27, 0], - 2447332.625 => [1988, 6, 20, 3], - 2436116.375 => [1957, 10, 4, 21], - 2454466.846527 => [2008, 1, 1, 8, 19] - ); - -foreach my $jd (keys %julianDays) { - my @time = @{ $julianDays{$jd} }; - my $epoch = timegm($time[5] || 0, $time[4] || 0, $time[3], $time[2], $time[1] - 1, $time[0]); - my $jdEpoch = julianDay2epoch($jd); - is($jdEpoch, $epoch, "jd2epoch($jd)". scalar gmtime($jdEpoch)); - my $epochJd = epoch2julianDay($epoch); - ok(abs($epochJd - $jd) < 0.0001, "epoch2jd($jd)"); -} From 80dd87cc68380db78f7334393e484188c831aa30 Mon Sep 17 00:00:00 2001 From: Frank Thomas Tveter Date: Wed, 3 May 2017 09:32:42 +0200 Subject: [PATCH 2/2] Delete 99-StressTest.t --- astro/src/astro/perl/t/99-StressTest.t | 69 -------------------------- 1 file changed, 69 deletions(-) delete mode 100644 astro/src/astro/perl/t/99-StressTest.t diff --git a/astro/src/astro/perl/t/99-StressTest.t b/astro/src/astro/perl/t/99-StressTest.t deleted file mode 100644 index 4980863..0000000 --- a/astro/src/astro/perl/t/99-StressTest.t +++ /dev/null @@ -1,69 +0,0 @@ -use Test::More; -use Time::Local qw(timegm_nocheck); -use Metno::Astro::AlmanacAlgorithm qw(:all); -use strict; -use warnings; - -use constant DAY => 24 * 60 * 60; -use constant DDAY => 16 * 60 * 60; - -my @places = ([59.91339, 10.7195], # Oslo - [63.42722, 10.39847], # Trondheim - [69.66233, 18.94189], # Tromsoe - [66.5075, 12.03083], # Traena - [51.47722, 0.0]); # Greenwich -my @years = (2000..2010); -my $testYear = 2008; -my @longitude = (-36..36); -my $lonMult = 5; -my @latitude = (-11..11); # problems close to poles -my $latMult = 8; - -plan tests => (scalar @places * scalar @years) + (scalar @longitude * scalar @latitude); - -# test places for all days during all years -for (my $p = 0; $p < @places; $p++) { - YEAR: foreach my $year (@years) { - ok(testYear(@{$places[$p]}, $year, 1), "place $p, year $year"); - } -} - -foreach my $lat (@latitude) { - my $lati = $lat *$latMult; - foreach my $lon (@longitude) { - my $long = $lon * $lonMult; - ok(testYear($lati, $long, $testYear, 30), "$lati,$long in $testYear"); - } -} - -# test worldwide for all days - - -sub testYear { - my ($lat, $lon, $year, $dayOffset) = @_; - $dayOffset = 1 unless $dayOffset; - # start at noon at that place - my $current = timegm_nocheck(0, 0, 12+($lon/180*12), 1, 0, $year); - for (my $d = 0; $d < 365; $d+=$dayOffset) { - my $eT; - my ($rise, $set, $transit, $vis); - eval { - my $jD = epoch2julianDay($current); - ($rise, $set, $transit, $vis) = riseSetTransit($lat, $lon, $jD, SUN); - $eT = julianDay2epoch($transit); - }; if ($@) { - print STDERR "ERROR: $@\n"; - print STDERR "year: $year day: $d\n"; - return 0; - } - if (($current-DDAY()) < $eT and $eT < ($current+DDAY())) { - $current += ($dayOffset * DAY); - } else { - print STDERR scalar gmtime($current), ": ", 12+(($lon/180)*12), " $lon", "\n"; - print STDERR scalar gmtime($eT), "\n"; - return 0 - } - } - return 1; -} -