2014-09-30 22:51:12 -07:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'sun_info';
|
|
|
|
zci is_cached => 0;
|
|
|
|
|
2014-10-01 14:15:01 -07:00
|
|
|
# Presume sun will rise in the morning and set at night year round in PA.
|
2014-10-28 09:37:01 -07:00
|
|
|
my @now = (qr/^On.*Phoenixville, Pennsylvania.*AM.*PM\.$/, html => qr/Phoenixville.*AM.*PM/);
|
|
|
|
my @aug = (qr/^On 30 Aug.*AM.*PM\.$/, html => qr/Phoenixville.*AM.*PM/);
|
2014-09-30 22:51:12 -07:00
|
|
|
my @exact = (
|
2014-10-28 09:37:01 -07:00
|
|
|
'On 01 Jan 2015, sunrise in Phoenixville, Pennsylvania is at 7:23 AM; sunset at 4:46 PM.',
|
|
|
|
html =>
|
|
|
|
qr{^<div class='zci--suninfo'><div class='suninfo--header text--secondary'><span class='ddgsi'>.*<img.*4:46 PM</span></span></div></div>$},
|
2014-09-30 22:51:12 -07:00
|
|
|
);
|
|
|
|
|
2014-10-10 01:59:21 -07:00
|
|
|
ddg_goodie_test(
|
|
|
|
[qw( DDG::Goodie::SunInfo )],
|
2014-10-01 00:47:08 -07:00
|
|
|
'sunrise' => test_zci(@now),
|
|
|
|
'what time is sunrise' => test_zci(@now),
|
|
|
|
'sunset' => test_zci(@now),
|
|
|
|
'what time is sunset' => test_zci(@now),
|
|
|
|
'sunrise for aug 30' => test_zci(@aug),
|
2014-10-10 01:59:21 -07:00
|
|
|
'sunrise 30 aug' => test_zci(@aug),
|
2014-10-01 00:47:08 -07:00
|
|
|
'sunset for aug 30?' => test_zci(@aug),
|
2014-10-10 01:59:21 -07:00
|
|
|
'sunset aug 30th' => test_zci(@aug),
|
2014-10-01 00:47:08 -07:00
|
|
|
'sunset on 2015-01-01' => test_zci(@exact),
|
|
|
|
'what time is sunrise on 2015-01-01?' => test_zci(@exact),
|
2014-10-10 01:59:21 -07:00
|
|
|
'January 1st, 2015 sunrise' => test_zci(@exact),
|
2014-10-01 22:26:10 -07:00
|
|
|
'sunset for philly' => undef,
|
2014-10-01 00:47:08 -07:00
|
|
|
'sunrise on mars' => undef,
|
|
|
|
'sunset boulevard' => undef,
|
|
|
|
'tequila sunrise' => undef,
|
|
|
|
'sunrise mall' => undef,
|
|
|
|
'after the sunset' => undef,
|
2014-09-30 22:51:12 -07:00
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|