2015-01-21 02:52:15 -08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Test::More;
|
|
|
|
use DDG::Test::Goodie;
|
|
|
|
|
|
|
|
zci answer_type => "combination";
|
|
|
|
zci is_cached => 1;
|
|
|
|
|
|
|
|
ddg_goodie_test(
|
|
|
|
[qw( DDG::Goodie::Combination )],
|
|
|
|
# At a minimum, be sure to include tests for all:
|
|
|
|
# - primary_example_queries
|
|
|
|
# - secondary_example_queries
|
|
|
|
'10 choose 3' => test_zci('120',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['10 choose 3'],
|
|
|
|
operation => 'choose',
|
|
|
|
result => '120',
|
2015-01-21 10:08:00 -08:00
|
|
|
}
|
|
|
|
),
|
|
|
|
'10 nCr 3' => test_zci('120',
|
|
|
|
structured_answer => {
|
|
|
|
input => ['10 choose 3'],
|
|
|
|
operation => 'choose',
|
|
|
|
result => '120',
|
2015-01-21 02:52:15 -08:00
|
|
|
}
|
|
|
|
),
|
|
|
|
'25 permute 16' => test_zci('4.27447366714368 * 10^19',
|
|
|
|
structured_answer => {
|
|
|
|
input => ["25 permute 16"],
|
|
|
|
operation => "permute",
|
2015-01-21 14:13:31 -08:00
|
|
|
result => "4.27447366714368*10^19"
|
2015-01-21 02:52:15 -08:00
|
|
|
}
|
|
|
|
),
|
|
|
|
'16 permutation 3' => test_zci('3,360',
|
|
|
|
structured_answer => {
|
|
|
|
input => ["16 permute 3"],
|
|
|
|
operation => "permute",
|
|
|
|
result => "3,360"
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'15 permutation 0' => test_zci('1',
|
|
|
|
structured_answer => {
|
|
|
|
input => ["15 permute 0"],
|
|
|
|
operation => "permute",
|
|
|
|
result => "1"
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'1,000 choose 2' => test_zci('499,500',
|
|
|
|
structured_answer => {
|
|
|
|
input => ["1,000 choose 2"],
|
|
|
|
operation => "choose",
|
|
|
|
result => "499,500"
|
|
|
|
}
|
|
|
|
),
|
|
|
|
'0 choose 100' => undef,
|
|
|
|
'10 choose 100' => undef,
|
|
|
|
'10.5 choose 1' => undef,
|
|
|
|
'1.000,5 choose 2' => undef,
|
|
|
|
);
|
|
|
|
|
|
|
|
done_testing;
|