2013-11-15 04:21:55 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
2014-01-23 10:35:48 -08:00
|
|
|
|
2013-11-15 04:21:55 -08:00
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => 'frequency_spectrum';
|
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-01-23 10:35:48 -08:00
|
|
|
['DDG::Goodie::FrequencySpectrum'],
|
2014-07-05 01:05:03 -07:00
|
|
|
|
|
|
|
#Primary example
|
2014-01-23 10:35:48 -08:00
|
|
|
'50 hz' => test_zci(
|
2014-07-05 01:05:03 -07:00
|
|
|
qr/radio.+SLF.+audible.+double-bass.+piano.+tuba/,
|
|
|
|
html => qr/radio/
|
2014-01-23 10:35:48 -08:00
|
|
|
),
|
2013-11-15 04:21:55 -08:00
|
|
|
|
2014-07-05 01:05:03 -07:00
|
|
|
#Secondary example
|
2014-01-23 10:35:48 -08:00
|
|
|
'400 thz' => test_zci(
|
2014-07-05 01:05:03 -07:00
|
|
|
qr/visible.+red/,
|
|
|
|
html => qr/visible.+red/
|
2014-01-23 10:35:48 -08:00
|
|
|
),
|
2013-11-15 04:21:55 -08:00
|
|
|
|
2014-07-05 01:05:03 -07:00
|
|
|
#Misc
|
2014-01-23 11:35:32 -08:00
|
|
|
'1,000 hz' => test_zci(
|
2014-07-05 01:05:03 -07:00
|
|
|
qr/radio.+audible.+human.+voice.+viola.+violin.+guitar.+mandolin.+banjo.+piano.+saxophone.+flute.+clarinet.+oboe/,
|
|
|
|
html => qr/radio.+/
|
2014-01-23 11:35:32 -08:00
|
|
|
),
|
|
|
|
'1000000.99 hz' => test_zci(
|
2014-07-05 01:05:03 -07:00
|
|
|
qr/radio.+MF/,
|
|
|
|
html => qr/radio.+MF/
|
2014-01-23 11:35:32 -08:00
|
|
|
),
|
|
|
|
|
2014-07-12 23:43:09 -07:00
|
|
|
#No whitespace between number and unit
|
|
|
|
'50hz' => test_zci(
|
|
|
|
qr/radio.+SLF.+audible.+double-bass.+piano.+tuba/,
|
|
|
|
html => qr/radio/
|
|
|
|
),
|
|
|
|
'400terahertz' => test_zci(
|
|
|
|
qr/visible.+red/,
|
|
|
|
html => qr/visible.+red/
|
|
|
|
),
|
|
|
|
|
2014-07-13 00:22:50 -07:00
|
|
|
#Commas in number
|
|
|
|
'1,000,000.99 hz' => test_zci(
|
|
|
|
qr/radio.+MF/,
|
|
|
|
html => qr/radio.+MF/
|
|
|
|
),
|
|
|
|
|
2014-07-05 01:05:03 -07:00
|
|
|
#Should not trigger
|
2014-01-23 11:35:32 -08:00
|
|
|
'1000.000..99 hz' => undef,
|
2014-07-05 01:05:03 -07:00
|
|
|
'4 thz' => undef,
|
2013-11-15 04:21:55 -08:00
|
|
|
);
|
|
|
|
|
2014-01-22 10:12:02 -08:00
|
|
|
done_testing;
|