zeroclickinfo-goodies/t/Coin.t

96 lines
2.5 KiB
Perl
Raw Normal View History

2013-02-09 10:19:53 -08:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'coin';
2014-10-14 23:46:29 -07:00
zci is_cached => 0;
2013-02-09 10:19:53 -08:00
ddg_goodie_test(
2014-10-14 23:46:29 -07:00
[qw( DDG::Goodie::Coin )],
2014-05-08 09:16:27 -07:00
'flip a coin' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
result => qr/^(heads|tails)$/
}
),
'flip coin' => test_zci(
qr/(heads|tails) \(random\)/,
structured_answer => {
2014-10-14 23:46:29 -07:00
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'flip 1 coin' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'flip 2 coins' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails), (heads|tails) \(random\)/,
structured_answer => {
input => [2],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/(heads|tails), /
}
2014-05-08 09:16:27 -07:00
),
'toss a coin' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'toss 1 coin' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'toss 2 coins' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails), (heads|tails) \(random\)/,
structured_answer => {
input => [2],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/(heads|tails), /
}
2014-05-08 09:16:27 -07:00
),
'heads or tails' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'heads or tails?' => test_zci(
2014-10-14 23:46:29 -07:00
qr/(heads|tails) \(random\)/,
structured_answer => {
input => [1],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/^(heads|tails)$/
}
2014-05-08 09:16:27 -07:00
),
'flip 4 coins' => test_zci(
2014-10-14 23:46:29 -07:00
qr/((heads|tails),? ){4}\(random\)/,
structured_answer => {
input => [4],
operation => 'Flip coin',
2014-10-14 23:46:29 -07:00
result => qr/(heads|tails),? /
}
2014-05-08 09:16:27 -07:00
),
2013-02-09 10:19:53 -08:00
);
done_testing;