package main; use strict; use warnings; use Astro::SpaceTrack; use Test; unless ($ENV{DEVELOPER_TEST}) { print "1..0 # skip Environment variable DEVELOPER_TEST not set.\n"; exit; } # The following hash is used to compute the todo list. The keys are # the OIDs for the Iridium satellites. The value for each key is a hash # containing the names of inconsistent data sources and a true value for # each inconsistent name. If all three sources are mutually inconsistent, # only two source names need be given. my %known_inconsistent = ( ### 27375 => {mccants => 1}, # Kelso & Sladen: operational; # McCants: spare. ### 24946 => {kelso => 1}, # Kelso: operational; others: tumbling ### 27372 => {mccants => 1}, # Kelso & Sladen: operational; # McCants: spare. ); #~14-Jan-2007 - McCants has 27450 (Iridium 97) in service, # 24967 (Iridium 36) spare. No change Kelso. # 21-Feb-2007 - Kelso has 27450 (Iridium 97) in service, # 24967 (Iridium 36) tumbling. No change McCants. # 06-Mar-2007 - McCants assumes Iridium 36 has failed. # 07-Aug-2008 - McCants has 24948 (Iridium 28) with possible control # issues about July 19 2008, with 27375 (Iridium 95) moved # about 14 seconds behind it. No change Kelso. # 23-Dec-2008 - McCants has 24948 (Iridium 28) uncontrolled, with 27375 # (Iridium 98) replacing it. # 10-Feb-2009 - Iridium 33 (24946) hit Cosmos 2251 (22675). # 11-Feb-2009 - Sladen noted probably nonfunctional, though # he still carries it in his operational grid. # 12-Feb-2009 - McCants noted tumbling. # 18-Feb-2009 - Kelso noted tumbling. # 09-Mar-2009 - Sladen & Kelso note Iridium 91 in service. # 22-May-2009 - Mike McCants notes Iridium 91 in service. my %status_map = ( &Astro::SpaceTrack::BODY_STATUS_IS_OPERATIONAL => 'Operational', &Astro::SpaceTrack::BODY_STATUS_IS_SPARE => 'Spare', &Astro::SpaceTrack::BODY_STATUS_IS_TUMBLING => 'Tumbling', ); my $st = Astro::SpaceTrack->new (); my @sources = qw{kelso mccants sladen}; my (%skip, %text, %status); my %name; foreach my $src (@sources) { my ($rslt, $data) = $st->iridium_status($src); if ($rslt->is_success) { $text{$src} = $rslt->content; my %sts; ref $data eq 'ARRAY' and %sts = map {$_->[0] => $_->[4]} @$data; $status{$src} = \%sts; foreach (@$data) { $name{$_->[0]} ||= $_->[1]; } } else { $skip{$src} = ucfirst($src) . ' data unavailable'; } } my @pairs; foreach my $inx (0 .. (scalar @sources - 2)) { foreach my $jnx ($inx + 1 .. (scalar @sources - 1)) { push @pairs, [$sources[$inx], $sources[$jnx]]; } } my @todo; my @keys; { # Begin local symbol block my %ky; foreach my $src (keys %status) { foreach my $oid (keys %{$status{$src}}) { $ky{$oid}++; } } @keys = sort {$a <=> $b} keys %ky; my $test = scalar @sources + 1; # Skip the bulk compares foreach my $id (@keys) { my $ki = $known_inconsistent{$id}; foreach my $pr (@pairs) { ($ki->{$pr->[0]} || $ki->{$pr->[1]}) and push @todo, $test; $test++; } } } plan tests => scalar @sources + scalar @keys * scalar @pairs, todo => \@todo; my $test = 0; foreach (["Mike McCants' Iridium status", mccants => < < <', $fn) or die "Unable to open $fn: $!"; print $fh $data; close $fh; $fn = "$file.got"; open ($fh, '>', $fn) or die "Unable to open $fn: $!"; print $fh $got; close $fh; warn <[$inx], join ' - ', @{$data[$inx]}; } @data = map {$_->[0]} @data; if ($data[0] =~ m/\D/ || $data[1] =~ m/\D/) { skip ($skip{$pr->[0]} || $skip{$pr->[1]}, $data[0] eq $data[1]); } else { skip ($skip{$pr->[0]} || $skip{$pr->[1]}, $data[0] == $data[1]); } } } 1;