Astro-MoonPhase-Simple

 view release on metacpan or  search on metacpan

t/900-pod-examples.t  view on Meta::CPAN

#!/usr/bin/env perl

use strict;
use warnings;

our $VERSION = '0.03';

use Test::More;

use FindBin;

use lib ($FindBin::Bin, 'blib/lib');

use Data::Roundtrip qw/perl2dump no-unicode-escape-permanently/;
use Config;

use Astro::MoonPhase::Simple;

my $VERBOSITY = 10;

###### WARNING These expected values expect
# that $dt->set_time_zone('UTC'); is used
# in lib/Astro/MoonPhase/Simple.pm
############################################

###### WARNING is_deeply()
# complains when it compares reals differing
# to the very last least-significant digits.
# (because we ask it to compare, e.g. Moon angle)
# the expected results (e.g. moon angle)
# were produced on my machine and can differ
# for other machines or for Perls compiled
# differently (e.g. see -Duselongdouble and
# the bug reported https://rt.cpan.org/Ticket/Display.html?id=154401)
# Moreover, in the expected results there is an 'asString'
# which contains lots of those real numbers all mixed up
# in a string.
# This can not be fixed even with the most elaborate is_deeply()
# therefore AT THE MOMENT I will check if perl was compiled
# with -Duselongdouble and if yes I will not run the is_deeply() test
# and wait for more reports.
############################################

my @tests = (
  {
    'params' => {
	'verbosity' => $VERBOSITY,
	'date' => '1974-07-14',
	'timezone' => 'Asia/Nicosia',
    },
    'expected' => {
  "MoonPhase%" => "79.4698014902281",
  "MoonIllum%" => "36.1415741763651",
  "MoonDist" => "382975.037274059",
  "MoonAge" => "23.4679002028918",
  "phases" => {
    "First quarter" => "Wed Jun 26 21:20:07 1974",
    "Last quarter" => "Fri Jul 12 17:28:59 1974",
    "New Moon" => "Thu Jun 20 06:55:39 1974",
    "Next New Moon" => "Fri Jul 19 14:06:16 1974",
    "Full moon" => "Thu Jul 04 14:40:23 1974"
  },
  "SunDist" => "152070449.472838",
  "MoonPhase" => "0.794698014902281",
  "MoonIllum" => "0.361415741763651",
  "asString" => "Moon age: 23.4679002028918 days\nMoon phase: 79.5 % of cycle (birth-to-death)\nMoon's illuminated fraction: 36.1 % of full disc\nimportant moon phases around specified date 1974-07-14:\n  New Moon      = Thu Jun 20 06:55:39 1974\n  F...
  "SunAng" => "0.524461848994832",
  "MoonAng" => "0.520029084708937"
    },
  },
  {
    'params' => {
	'verbosity' => $VERBOSITY,
	'date' => '1974-07-14',



( run in 0.561 second using v1.01-cache-2.11-cpan-39bf76dae61 )