zeroclickinfo-goodies/t/Sort.t

82 lines
2.6 KiB
Perl
Raw Normal View History

2012-12-05 12:17:45 -08:00
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use DDG::Test::Goodie;
zci answer_type => 'sort';
2014-10-07 03:40:21 -07:00
zci is_cached => 1;
2012-12-05 12:17:45 -08:00
ddg_goodie_test(
2014-10-07 03:40:21 -07:00
[qw( DDG::Goodie::Sort)],
'sort -1, +4, -3, 5.7' => test_zci(
'-3, -1, 4, 5.7 (Sorted ascendingly)',
structured_answer => {
input => ['-1, 4, -3, 5.7'],
operation => 'Sort ascendingly',
2014-10-07 03:40:21 -07:00
result => '-3, -1, 4, 5.7'
}
),
'sort [-1, +4, -3, 5.7]' => test_zci(
'-3, -1, 4, 5.7 (Sorted ascendingly)',
structured_answer => {
input => ['-1, 4, -3, 5.7'],
operation => 'Sort ascendingly',
2014-10-07 03:40:21 -07:00
result => '-3, -1, 4, 5.7'
}
),
'sort (-1, +4, -3, 5.7)' => test_zci(
'-3, -1, 4, 5.7 (Sorted ascendingly)',
structured_answer => {
input => ['-1, 4, -3, 5.7'],
operation => 'Sort ascendingly',
2014-10-07 03:40:21 -07:00
result => '-3, -1, 4, 5.7'
}
),
'sort desc -4.4 .5 1 66 15 -55' => test_zci(
'66, 15, 1, 0.5, -4.4, -55 (Sorted descendingly)',
structured_answer => {
input => ['-4.4, 0.5, 1, 66, 15, -55'],
operation => 'sort descendingly',
result => '66, 15, 1, 0.5, -4.4, -55'
}
),
'sort desc -4.4 .5 1 66 2e-3 15 -55' => test_zci(
'66, 15, 1, 0.5, 0.002, -4.4, -55 (Sorted descendingly)',
structured_answer => {
input => ['-4.4, 0.5, 1, 66, 0.002, 15, -55'],
operation => 'sort descendingly',
result => '66, 15, 1, 0.5, 0.002, -4.4, -55'
}
),
'sort -3 -10 56 10' => test_zci(
'-10, -3, 10, 56 (Sorted ascendingly)',
structured_answer => {
input => ['-3, -10, 56, 10'],
operation => 'Sort ascendingly',
2014-10-07 03:40:21 -07:00
result => '-10, -3, 10, 56'
}
),
'sort descending 10, -1, +5.3, -95, 1' => test_zci(
'10, 5.3, 1, -1, -95 (Sorted descendingly)',
structured_answer => {
input => ['10, -1, 5.3, -95, 1'],
operation => 'sort descendingly',
result => '10, 5.3, 1, -1, -95'
}
),
'sort descending 10, -1, +5.3, -95, 1, 1e2' => test_zci(
'100, 10, 5.3, 1, -1, -95 (Sorted descendingly)',
structured_answer => {
input => ['10, -1, 5.3, -95, 1, 100'],
operation => 'sort descendingly',
result => '100, 10, 5.3, 1, -1, -95'
}
),
'sort algorithm' => undef,
'sort 1 fish, 2 fish' => undef,
2012-12-05 12:17:45 -08:00
);
done_testing;