FrequencySpectrum: Squelch print statements and add a test.
parent
3e61693508
commit
2bd38a6a9b
|
@ -135,8 +135,6 @@ handle query => sub {
|
|||
sub normalize_freq{
|
||||
my $freq = $_;
|
||||
|
||||
print $freq;
|
||||
|
||||
if($freq =~ m/(?:\.\.)|(?:,,)/) {
|
||||
#consecutive dots or commas are not allowed
|
||||
return;
|
||||
|
@ -165,7 +163,6 @@ sub normalize_freq{
|
|||
return;
|
||||
}
|
||||
|
||||
print $freq;
|
||||
return $freq;
|
||||
};
|
||||
|
||||
|
|
|
@ -2,35 +2,37 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => 'frequency_spectrum';
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw(
|
||||
DDG::Goodie::FrequencySpectrum
|
||||
)],
|
||||
'50 hz' => test_zci(
|
||||
'50 Hz is a radio frequency in the SLF band used by submarine communication systems.
|
||||
['DDG::Goodie::FrequencySpectrum'],
|
||||
'50 hz' => test_zci(
|
||||
'50 Hz is a radio frequency in the SLF band used by submarine communication systems.
|
||||
50 Hz is also an audible frequency which can be produced by double-bass, piano, and tuba.
|
||||
More at https://en.wikipedia.org/wiki/Musical_acoustics',
|
||||
html => "50 Hz is a radio frequency in the SLF band used by submarine communication systems.<br>50 Hz is also an audible frequency which can be produced by double-bass, piano, and tuba.<br><a href='https://en.wikipedia.org/wiki/Musical_acoustics'>More at Wikipedia</a>",
|
||||
heading => '50 Hz (Frequency Spectrum)'
|
||||
),
|
||||
|
||||
html => "50 Hz is a radio frequency in the SLF band used by submarine communication systems.<br>50 Hz is also an audible frequency which can be produced by double-bass, piano, and tuba.<br><a href='https://en.wikipedia.org/wiki/Musical_acoustics'>More at Wikipedia</a>",
|
||||
|
||||
heading=> '50 Hz (Frequency Spectrum)'
|
||||
),
|
||||
|
||||
'400 thz' => test_zci(
|
||||
'400 THz is an electromagnetic frequency of red light.
|
||||
'400 thz' => test_zci(
|
||||
'400 THz is an electromagnetic frequency of red light.
|
||||
More at https://en.wikipedia.org/wiki/Color',
|
||||
html => "400 THz is an electromagnetic frequency of red light.<br><a href='https://en.wikipedia.org/wiki/Color'>More at Wikipedia</a>",
|
||||
heading => '400 THz (Frequency Spectrum)'
|
||||
),
|
||||
|
||||
html => "400 THz is an electromagnetic frequency of red light.<br><a href='https://en.wikipedia.org/wiki/Color'>More at Wikipedia</a>",
|
||||
|
||||
heading=> '400 THz (Frequency Spectrum)'
|
||||
),
|
||||
|
||||
'4 thz' => undef,
|
||||
'4 thz' => undef,
|
||||
|
||||
'1,000' => test_zci(
|
||||
'1 kHz is a radio frequency in the ULF band used by mine cave communication systems.
|
||||
1 kHz is also an audible frequency which can be produced by human voice, viola, violin, guitar, mandolin, banjo, piano, saxophone, flute, clarinet, and oboe.
|
||||
More at https://en.wikipedia.org/wiki/Musical_acoustics',
|
||||
html => "1 kHz is a radio frequency in the ULF band used by mine cave communication systems.<br>1 kHz is also an audible frequency which can be produced by human voice, viola, violin, guitar, mandolin, banjo, piano, saxophone, flute, clarinet, and oboe.<br><a href='https://en.wikipedia.org/wiki/Musical_acoustics'>More at Wikipedia</a>",
|
||||
heading => '1 kHz (Frequency Spectrum)'
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
|
Loading…
Reference in New Issue