forked from duckduckgo/zeroclickinfo-goodies
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for Base64, Dice, EmToPx, FlipText, GoldenRatio, Guid, Pe…
…riemeter, Roman, SigFigs, TitleCase, Unicode
- Loading branch information
Showing
11 changed files
with
202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'conversion'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::Base | ||
)], | ||
'10 in base 3' => test_zci('10 in base 3 is 101'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'dice_roll'; | ||
zci is_cached => 0; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::Dice | ||
)], | ||
'throw dice' => test_zci(qr/\d \d/), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'conversion'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::EmToPx | ||
)], | ||
'10 px to em' => test_zci('0.625 em in 10 px'), | ||
'10 px to em' => test_zci(qr/0\.625/), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'flip_text'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::FlipText | ||
)], | ||
'flip test' => test_zci("\x{0287}\x{0073}\x{01DD}\x{0287}"), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'golden_ratio'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::GoldenRatio | ||
)], | ||
'golden ratio 1:?' => test_zci('Golden ratio: 1 : 1.61803398874989'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'guid'; | ||
zci is_cached => 0; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::GUID | ||
)], | ||
'guid' => test_zci(qr/\(randomly generated\)/), | ||
'uuid' => test_zci(qr/\(randomly generated\)/), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'perimeter'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::Perimeter | ||
)], | ||
'circumference circle 1' => test_zci('Circumference: 6.28318530717959'), | ||
'perimeter hexagon 45' => test_zci('Perimeter of hexagon: 270'), | ||
'perimeter of triangle 1.5 2 3.2' => test_zci('Perimeter of triangle: 6.7'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'roman_numeral_conversion'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::Roman | ||
)], | ||
'roman 155' => test_zci('CLV (roman numeral conversion)'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'sig_figs'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::SigFigs | ||
)], | ||
'sf 78' => test_zci('Significant figures: 2'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'title_case'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::TitleCase | ||
)], | ||
'titlecase test this out' => test_zci('Test This Out'), | ||
); | ||
|
||
done_testing; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use DDG::Test::Goodie; | ||
|
||
zci answer_type => 'unicode_conversion'; | ||
zci is_cached => 1; | ||
|
||
ddg_goodie_test( | ||
[qw( | ||
DDG::Goodie::Unicode | ||
)], | ||
'U+263A' => test_zci("\x{263A} U+263A WHITE SMILING FACE, decimal: 9786, HTML: ☺, UTF-8: 0xE2 0x98 0xBA, block: Miscellaneous Symbols"), | ||
); | ||
|
||
done_testing; |