### ----------------------------------------------------
### -- Moonphase
### -- Licenses: Artistic-2.0
### -- Authors: librasteve
### -- File: t/01-moonillumination.rakutest
### ----------------------------------------------------
use Test;
use Moonphase;

plan 4;

sub moon-illumination($timestamp) {
    my $inst = Instant.from-posix: $timestamp;

    return ((1 - cos moonphase($inst)) / 2) * 100;
}

my &mi = &moon-illumination;

ok &mi(-178070400).round(0.1) ==  1.2, 'test1';
ok &mi( 361411200).round(0.1) == 93.6, 'test2';
ok &mi(1704931200).round(0.1) ==  0.4, 'test3';
ok &mi(2898374400).round(0.1) == 44.2, 'test4';

done-testing;


