Skip to content

Commit

Permalink
Added tests for Base64, Dice, EmToPx, FlipText, GoldenRatio, Guid, Pe…
Browse files Browse the repository at this point in the history
…riemeter, Roman, SigFigs, TitleCase, Unicode
  • Loading branch information
majuscule committed Apr 15, 2012
1 parent b657387 commit d2bde79
Show file tree
Hide file tree
Showing 11 changed files with 202 additions and 0 deletions.
18 changes: 18 additions & 0 deletions t/Base64.t
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;
18 changes: 18 additions & 0 deletions t/Dice.t
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;
19 changes: 19 additions & 0 deletions t/EmToPx.t
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;
18 changes: 18 additions & 0 deletions t/FlipText.t
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;
18 changes: 18 additions & 0 deletions t/GoldenRatio.t
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;
19 changes: 19 additions & 0 deletions t/Guid.t
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;
20 changes: 20 additions & 0 deletions t/Perimeter.t
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;
18 changes: 18 additions & 0 deletions t/Roman.t
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;
18 changes: 18 additions & 0 deletions t/SigFigs.t
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;
18 changes: 18 additions & 0 deletions t/TitleCase.t
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;
18 changes: 18 additions & 0 deletions t/Unicode.t
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;

0 comments on commit d2bde79

Please sign in to comment.