2013-03-11 12:48:29 -07:00
|
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
use warnings;
|
|
|
|
|
use Test::More;
|
2016-05-16 06:07:57 -07:00
|
|
|
|
use Test::Deep;
|
2013-03-11 12:48:29 -07:00
|
|
|
|
use DDG::Test::Goodie;
|
2014-03-24 06:29:52 -07:00
|
|
|
|
use DDG::Goodie::Calculator; # For function subtests.
|
2015-07-20 06:08:55 -07:00
|
|
|
|
use utf8;
|
2013-03-11 12:48:29 -07:00
|
|
|
|
|
|
|
|
|
zci answer_type => 'calc';
|
2014-03-24 06:28:54 -07:00
|
|
|
|
zci is_cached => 1;
|
2013-03-11 12:48:29 -07:00
|
|
|
|
|
|
|
|
|
ddg_goodie_test(
|
2014-03-24 06:28:54 -07:00
|
|
|
|
[qw( DDG::Goodie::Calculator )],
|
|
|
|
|
'what is 2-2' => test_zci(
|
|
|
|
|
"2 - 2 = 0",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2 - 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'solve 2+2' => test_zci(
|
|
|
|
|
"2 + 2 = 4",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2 + 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>4</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2^8' => test_zci(
|
|
|
|
|
"2 ^ 8 = 256",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 8'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>256</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2 *7' => test_zci(
|
|
|
|
|
"2 * 7 = 14",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2 * 7'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>14</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
2015-07-09 08:47:02 -07:00
|
|
|
|
'4 ∙ 5' => test_zci(
|
|
|
|
|
"4 * 5 = 20",
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['4 * 5'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>20</)
|
2015-07-09 08:47:02 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'6 ⋅ 7' => test_zci(
|
|
|
|
|
"6 * 7 = 42",
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['6 * 7'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>42</)
|
2015-07-09 08:47:02 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'3 × dozen' => test_zci(
|
|
|
|
|
"3 * dozen = 36",
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['3 * dozen'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>36</)
|
2015-07-09 08:47:02 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'dozen ÷ 4' => test_zci(
|
|
|
|
|
"dozen / 4 = 3",
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['dozen / 4'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>3</)
|
2015-07-09 08:47:02 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
2014-03-24 06:28:54 -07:00
|
|
|
|
'1 dozen * 2' => test_zci(
|
|
|
|
|
"1 dozen * 2 = 24",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1 dozen * 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>24</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'dozen + dozen' => test_zci(
|
|
|
|
|
"dozen + dozen = 24",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['dozen + dozen'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>24</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2divided by 4' => test_zci(
|
|
|
|
|
"2 divided by 4 = 0.5",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2 divided by 4'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0.5</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2^2' => test_zci(
|
|
|
|
|
"2 ^ 2 = 4",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>4</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2^0.2' => test_zci(
|
|
|
|
|
"2 ^ 0.2 = 1.14869835499704",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 0.2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.14869835499704</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'cos(0)' => test_zci(
|
|
|
|
|
"cos(0) = 1",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['cos(0)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'tan(1)' => test_zci(
|
|
|
|
|
"tan(1) = 1.5574077246549",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['tan(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.5574077246549</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
2014-04-05 21:04:26 -07:00
|
|
|
|
'tanh(1)' => test_zci(
|
|
|
|
|
"tanh(1) = 0.761594155955765",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['tanh(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0\.761594155955765</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
|
|
|
|
'cotan(1)' => test_zci(
|
|
|
|
|
"cotan(1) = 0.642092615934331",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['cotan(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0\.642092615934331</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
2014-03-24 06:28:54 -07:00
|
|
|
|
'sin(1)' => test_zci(
|
|
|
|
|
"sin(1) = 0.841470984807897",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sin(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0\.841470984807897</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
2014-04-05 21:04:26 -07:00
|
|
|
|
'csc(1)' => test_zci(
|
|
|
|
|
"csc(1) = 1.18839510577812",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['csc(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.18839510577812</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
|
|
|
|
'sec(1)' => test_zci(
|
|
|
|
|
"sec(1) = 1.85081571768093",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sec(1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.85081571768093</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
2014-05-22 09:50:28 -07:00
|
|
|
|
'log(3)' => test_zci(
|
|
|
|
|
"log(3) = 1.09861228866811",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log(3)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.09861228866811</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
|
|
|
|
'ln(3)' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
"log(3) = 1.09861228866811",
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log(3)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.09861228866811</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
2014-04-05 21:04:26 -07:00
|
|
|
|
'log10(100.00)' => test_zci(
|
|
|
|
|
"log10(100.00) = 2",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log10(100.00)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
2014-05-22 09:50:28 -07:00
|
|
|
|
'log_10(100.00)' => test_zci(
|
|
|
|
|
"log_10(100.00) = 2",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log_10(100.00)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
|
|
|
|
'log_2(16)' => test_zci(
|
|
|
|
|
"log_2(16) = 4",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log_2(16)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>4</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
|
|
|
|
'log_23(25)' => test_zci(
|
|
|
|
|
"log_23(25) = 1.0265928122321",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log_23(25)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.0265928122321</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
|
|
|
|
'log23(25)' => test_zci(
|
|
|
|
|
"log23(25) = 1.0265928122321",
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['log23(25)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.0265928122321</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
2014-03-24 06:28:54 -07:00
|
|
|
|
'$3.43+$34.45' => test_zci(
|
|
|
|
|
'$3.43 + $34.45 = $37.88',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['$3.43 + $34.45'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>\$37\.88</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
2014-03-29 19:27:18 -07:00
|
|
|
|
'$3.45+$34.45' => test_zci(
|
|
|
|
|
'$3.45 + $34.45 = $37.90',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['$3.45 + $34.45'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>\$37\.90</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 19:27:18 -07:00
|
|
|
|
),
|
|
|
|
|
'$3+$34' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'$3 + $34 = $37.00',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['$3 + $34'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>\$37\.00</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 19:27:18 -07:00
|
|
|
|
),
|
|
|
|
|
'$3,4+$34,4' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'$3,4 + $34,4 = $37,80',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['$3,4 + $34,4'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>\$37,80</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 19:27:18 -07:00
|
|
|
|
),
|
2014-03-24 06:28:54 -07:00
|
|
|
|
'64*343' => test_zci(
|
|
|
|
|
'64 * 343 = 21,952',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['64 * 343'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>21,952</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'1E2 + 1' => test_zci(
|
|
|
|
|
'(1 * 10 ^ 2) + 1 = 101',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(1 * 10 ^ 2) + 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>101</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'1 + 1E2' => test_zci(
|
|
|
|
|
'1 + (1 * 10 ^ 2) = 101',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['1 + (1 * 10 ^ 2)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>101</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2 * 3 + 1E2' => test_zci(
|
|
|
|
|
'2 * 3 + (1 * 10 ^ 2) = 106',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 * 3 + (1 * 10 ^ 2)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>106</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'1E2 + 2 * 3' => test_zci(
|
|
|
|
|
'(1 * 10 ^ 2) + 2 * 3 = 106',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(1 * 10 ^ 2) + 2 * 3'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>106</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'1E2 / 2' => test_zci(
|
|
|
|
|
'(1 * 10 ^ 2) / 2 = 50',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(1 * 10 ^ 2) / 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>50</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'2 / 1E2' => test_zci(
|
|
|
|
|
'2 / (1 * 10 ^ 2) = 0.02',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 / (1 * 10 ^ 2)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0\.02</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'424334+2253828' => test_zci(
|
|
|
|
|
'424334 + 2253828 = 2,678,162',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['424334 + 2253828'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2,678,162</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
|
|
|
|
'4.243,34+22.538,28' => test_zci(
|
|
|
|
|
'4.243,34 + 22.538,28 = 26.781,62',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['4.243,34 + 22.538,28'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>26\.781,62</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-24 06:28:54 -07:00
|
|
|
|
),
|
2014-03-28 22:51:59 -07:00
|
|
|
|
'sin(1,0) + 1,05' => test_zci(
|
|
|
|
|
'sin(1,0) + 1,05 = 1,8914709848079',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sin(1,0) + 1,05'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1,8914709848079</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-28 22:51:59 -07:00
|
|
|
|
),
|
2014-03-29 19:27:18 -07:00
|
|
|
|
'21 + 15 x 0 + 5' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'21 + 15 * 0 + 5 = 26',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['21 + 15 * 0 + 5'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>26</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 17:07:02 -07:00
|
|
|
|
),
|
2014-03-29 19:27:18 -07:00
|
|
|
|
'0.8158 - 0.8157' => test_zci(
|
|
|
|
|
'0.8158 - 0.8157 = 0.0001',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['0.8158 - 0.8157'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0\.0001</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 19:27:18 -07:00
|
|
|
|
),
|
|
|
|
|
'2,90 + 4,6' => test_zci(
|
|
|
|
|
'2,90 + 4,6 = 7,50',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2,90 + 4,6'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>7,50</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-03-29 19:27:18 -07:00
|
|
|
|
),
|
2014-04-05 21:04:26 -07:00
|
|
|
|
'2,90 + sec(4,6)' => test_zci(
|
|
|
|
|
'2,90 + sec(4,6) = -6,01642861135959',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2,90 + sec(4,6)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>-6,01642861135959</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-05 21:04:26 -07:00
|
|
|
|
),
|
2014-04-30 10:10:39 -07:00
|
|
|
|
'100 - 96.54' => test_zci(
|
|
|
|
|
'100 - 96.54 = 3.46',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['100 - 96.54'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>3\.46</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-04-30 10:10:39 -07:00
|
|
|
|
),
|
2014-05-22 09:50:28 -07:00
|
|
|
|
'1. + 1.' => test_zci(
|
|
|
|
|
'1. + 1. = 2',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1. + 1.'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-05-22 09:50:28 -07:00
|
|
|
|
),
|
2014-06-04 07:52:36 -07:00
|
|
|
|
'1 + sin(pi)' => test_zci(
|
|
|
|
|
'1 + sin(pi) = 1',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1 + sin(pi)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-04 07:52:36 -07:00
|
|
|
|
),
|
|
|
|
|
'1 - 1' => test_zci(
|
|
|
|
|
'1 - 1 = 0',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1 - 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-04 07:52:36 -07:00
|
|
|
|
),
|
|
|
|
|
'sin(pi/2)' => test_zci(
|
|
|
|
|
'sin(pi / 2) = 1',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sin(pi / 2)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-04 07:52:36 -07:00
|
|
|
|
),
|
|
|
|
|
'sin(pi)' => test_zci(
|
|
|
|
|
'sin(pi) = 0',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sin(pi)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-04 07:52:36 -07:00
|
|
|
|
),
|
|
|
|
|
'cos(2pi)' => test_zci(
|
|
|
|
|
'cos(2 pi) = 1',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['cos(2 pi)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-04 07:52:36 -07:00
|
|
|
|
),
|
2014-06-14 13:37:25 -07:00
|
|
|
|
'5 squared' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'5 ^ 2 = 25',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['5 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>25</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
2015-03-20 22:22:53 -07:00
|
|
|
|
'sqrt(4)' => test_zci(
|
|
|
|
|
'sqrt(4) = 2',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sqrt(4)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2</)
|
2015-03-20 22:22:53 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
2014-06-14 13:37:25 -07:00
|
|
|
|
'1.0 + 5 squared' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'1.0 + 5 ^ 2 = 26',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['1.0 + 5 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>26</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
|
|
|
|
'3 squared + 4 squared' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'3 ^ 2 + 4 ^ 2 = 25',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['3 ^ 2 + 4 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>25</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
|
|
|
|
'2,2 squared' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'2,2 ^ 2 = 4,84',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2,2 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>4,84</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
|
|
|
|
'0.8^2 + 0.6^2' => test_zci(
|
|
|
|
|
'0.8 ^ 2 + 0.6 ^ 2 = 1',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['0.8 ^ 2 + 0.6 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</),
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
|
|
|
|
'2 squared ^ 3' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'2 ^ 2 ^ 3 = 256',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 2 ^ 3'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>256</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
2014-06-20 17:32:50 -07:00
|
|
|
|
'2 squared ^ 3.06' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'2 ^ 2 ^ 3.06 = 323.972172143725',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 2 ^ 3.06'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>323\.972172143725</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
2014-06-14 13:37:25 -07:00
|
|
|
|
'2^3 squared' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'2 ^ 3 ^ 2 = 512',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['2 ^ 3 ^ 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>512</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
2015-03-23 08:40:06 -07:00
|
|
|
|
'sqrt(2)' => test_zci(
|
|
|
|
|
'sqrt(2) = 1.4142135623731',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sqrt(2)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.4142135623731</)
|
2015-03-23 08:40:06 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'sqrt(3 pi / 4 + 1) + 1' => test_zci(
|
|
|
|
|
'sqrt(3 pi / 4 + 1) + 1 = 2.83199194599549',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['sqrt(3 pi / 4 + 1) + 1'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2\.83199194599549</)
|
2015-03-23 08:40:06 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
2014-06-14 13:37:25 -07:00
|
|
|
|
'4 score + 7' => test_zci(
|
|
|
|
|
'4 score + 7 = 87',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['4 score + 7'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>87</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-14 13:37:25 -07:00
|
|
|
|
),
|
2014-06-23 22:18:36 -07:00
|
|
|
|
'418.1 / 2' => test_zci(
|
|
|
|
|
'418.1 / 2 = 209.05',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['418.1 / 2'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>209\.05</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-23 22:18:36 -07:00
|
|
|
|
),
|
|
|
|
|
'418.005 / 8' => test_zci(
|
|
|
|
|
'418.005 / 8 = 52.250625',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['418.005 / 8'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>52\.250625</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-23 22:18:36 -07:00
|
|
|
|
),
|
2014-06-20 17:32:50 -07:00
|
|
|
|
'(pi^4+pi^5)^(1/6)' => test_zci(
|
|
|
|
|
'(pi ^ 4 + pi ^ 5) ^ (1 / 6) = 2.71828180861191',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(pi ^ 4 + pi ^ 5) ^ (1 / 6)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2\.71828180861191</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
|
|
|
|
'(pi^4+pi^5)^(1/6)+1' => test_zci(
|
|
|
|
|
'(pi ^ 4 + pi ^ 5) ^ (1 / 6) + 1 = 3.71828180861191',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(pi ^ 4 + pi ^ 5) ^ (1 / 6) + 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>3\.71828180861191</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
|
|
|
|
'5^4^(3-2)^1' => test_zci(
|
|
|
|
|
'5 ^ 4 ^ (3 - 2) ^ 1 = 625',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['5 ^ 4 ^ (3 - 2) ^ 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>625</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
|
|
|
|
'(5-4)^(3-2)^1' => test_zci(
|
|
|
|
|
'(5 - 4) ^ (3 - 2) ^ 1 = 1',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(5 - 4) ^ (3 - 2) ^ 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
|
|
|
|
'(5+4-3)^(2-1)' => test_zci(
|
|
|
|
|
'(5 + 4 - 3) ^ (2 - 1) = 6',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(5 + 4 - 3) ^ (2 - 1)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>6</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
|
|
|
|
'5^((4-3)*(2+1))+6' => test_zci(
|
|
|
|
|
'5 ^ ((4 - 3) * (2 + 1)) + 6 = 131',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['5 ^ ((4 - 3) * (2 + 1)) + 6'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>131</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-06-20 17:32:50 -07:00
|
|
|
|
),
|
2014-07-09 13:32:04 -07:00
|
|
|
|
'20x07' => test_zci(
|
2014-10-22 23:58:20 -07:00
|
|
|
|
'20 * 07 = 140',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['20 * 07'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>140</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-07-09 13:32:04 -07:00
|
|
|
|
),
|
2014-07-09 14:02:24 -07:00
|
|
|
|
'83.166.167.160/33' => test_zci(
|
|
|
|
|
'83.166.167.160 / 33 = 2.520.186.883,63636',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['83.166.167.160 / 33'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2\.520\.186\.883,63636</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-07-09 14:02:24 -07:00
|
|
|
|
),
|
2014-07-09 14:33:43 -07:00
|
|
|
|
'123.123.123.123/255.255.255.256' => test_zci(
|
|
|
|
|
'123.123.123.123 / 255.255.255.256 = 0,482352941174581',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['123.123.123.123 / 255.255.255.256'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0,482352941174581</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-07-09 14:33:43 -07:00
|
|
|
|
),
|
2014-07-27 06:58:25 -07:00
|
|
|
|
'4E5 +1 ' => test_zci(
|
|
|
|
|
'(4 * 10 ^ 5) + 1 = 400,001',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(4 * 10 ^ 5) + 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>400,001</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-07-27 06:58:25 -07:00
|
|
|
|
),
|
|
|
|
|
'4e5 +1 ' => test_zci(
|
|
|
|
|
'(4 * 10 ^ 5) + 1 = 400,001',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['(4 * 10 ^ 5) + 1'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>400,001</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-07-27 06:58:25 -07:00
|
|
|
|
),
|
2015-12-08 11:17:52 -08:00
|
|
|
|
'3e-2* 9 ' => test_zci(
|
|
|
|
|
'(3 * 10 ^- 2) * 9 = 0.27',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['(3 * 10 ^- 2) * 9'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0.27</)
|
2015-12-08 11:17:52 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'7e-4 *8' => test_zci(
|
|
|
|
|
'(7 * 10 ^- 4) * 8 = 0.0056',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['(7 * 10 ^- 4) * 8'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>0.0056</)
|
2015-12-08 11:17:52 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
2015-12-08 12:16:18 -08:00
|
|
|
|
'6 * 2e-11' => test_zci(
|
|
|
|
|
'6 * (2 * 10 ^- 11) = 1.2 * 10^-10',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['6 * (2 * 10 ^- 11)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>1\.2 \* 10<sup>-10<\/sup></)
|
2015-12-08 12:16:18 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'7 + 7e-7' => test_zci(
|
|
|
|
|
'7 + (7 * 10 ^- 7) = 7.0000007',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['7 + (7 * 10 ^- 7)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>7.0000007</)
|
2015-12-08 12:16:18 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
2015-12-09 07:47:10 -08:00
|
|
|
|
'1 * 7 + e-7' => test_zci(
|
|
|
|
|
'1 * 7 + e - 7 = 2.71828182845905',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1 * 7 + e - 7'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>2.71828182845905</)
|
2015-12-09 07:47:10 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'7 * e- 5' => test_zci(
|
|
|
|
|
'7 * e - 5 = 14.0279727992134',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['7 * e - 5'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>14.0279727992134</)
|
2015-12-09 07:47:10 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
2014-08-14 05:43:37 -07:00
|
|
|
|
'pi/1e9' => test_zci(
|
|
|
|
|
'pi / (1 * 10 ^ 9) = 3.14159265358979 * 10^-9',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['pi / (1 * 10 ^ 9)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>3\.14159265358979 \* 10<sup>-9<\/sup></)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-08-14 05:43:37 -07:00
|
|
|
|
),
|
|
|
|
|
'pi*1e9' => test_zci(
|
|
|
|
|
'pi * (1 * 10 ^ 9) = 3,141,592,653.58979',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2014-12-13 19:55:05 -08:00
|
|
|
|
input => ['pi * (1 * 10 ^ 9)'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>3,141,592,653\.58979</)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-08-14 05:43:37 -07:00
|
|
|
|
),
|
2014-11-14 23:14:34 -08:00
|
|
|
|
'1 234 + 5 432' => test_zci(
|
|
|
|
|
'1234 + 5432 = 6,666',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1234 + 5432'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/6,666/)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-11-14 23:14:34 -08:00
|
|
|
|
),
|
|
|
|
|
'1_234 + 5_432' => test_zci(
|
|
|
|
|
'1234 + 5432 = 6,666',
|
2014-10-22 23:58:20 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['1234 + 5432'],
|
2015-01-09 00:46:54 -08:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/6,666/)
|
2014-10-22 23:58:20 -07:00
|
|
|
|
}
|
2014-11-14 23:14:34 -08:00
|
|
|
|
),
|
2015-03-29 14:37:07 -07:00
|
|
|
|
'(0.4e^(0))*cos(0)' => test_zci(
|
2015-03-29 15:07:12 -07:00
|
|
|
|
'(0.4e ^ (0)) * cos(0) = 0.4',
|
2015-03-29 14:37:07 -07:00
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
2015-03-29 15:07:12 -07:00
|
|
|
|
input => ['(0.4e ^ (0)) * cos(0)'],
|
2015-03-29 14:37:07 -07:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr'0.4')
|
2015-03-29 14:37:07 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
2015-03-29 14:49:43 -07:00
|
|
|
|
'2pi' => test_zci(
|
2015-03-29 15:07:12 -07:00
|
|
|
|
'2 pi = 6.28318530717958',
|
2015-03-29 14:49:43 -07:00
|
|
|
|
heading => 'Calculator',
|
2015-03-29 15:07:12 -07:00
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['2 pi'],
|
2015-03-29 14:49:43 -07:00
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr"6.28318530717958")
|
2015-03-29 14:49:43 -07:00
|
|
|
|
}
|
|
|
|
|
),
|
2015-11-23 07:47:31 -08:00
|
|
|
|
'fact(3)' => test_zci(
|
|
|
|
|
'fact(3) = 6',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['fact(3)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>6</)
|
2015-11-23 07:47:31 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
|
|
|
|
'factorial(3)' => test_zci(
|
|
|
|
|
'fact(3) = 6',
|
|
|
|
|
heading => 'Calculator',
|
|
|
|
|
structured_answer => {
|
|
|
|
|
input => ['fact(3)'],
|
|
|
|
|
operation => 'Calculate',
|
2016-05-16 06:07:57 -07:00
|
|
|
|
result => re(qr/>6</)
|
2015-11-23 07:47:31 -08:00
|
|
|
|
}
|
|
|
|
|
),
|
2014-07-09 14:33:43 -07:00
|
|
|
|
'123.123.123.123/255.255.255.255' => undef,
|
|
|
|
|
'83.166.167.160/27' => undef,
|
|
|
|
|
'9 + 0 x 07' => undef,
|
|
|
|
|
'0x07' => undef,
|
|
|
|
|
'sin(1.0) + 1,05' => undef,
|
|
|
|
|
'4,24,334+22,53,828' => undef,
|
|
|
|
|
'5234534.34.54+1' => undef,
|
|
|
|
|
'//' => undef,
|
|
|
|
|
dividedbydividedby => undef,
|
|
|
|
|
time => undef, # We eval perl directly, only do whitelisted stuff!
|
|
|
|
|
'four squared' => undef,
|
2014-08-12 11:57:31 -07:00
|
|
|
|
'! + 1' => undef, # Regression test for bad query trigger.
|
2014-11-04 14:34:54 -08:00
|
|
|
|
'$5' => undef,
|
|
|
|
|
'calculate 5' => undef,
|
|
|
|
|
'solve $50' => undef,
|
2015-09-25 16:28:28 -07:00
|
|
|
|
'382-538-2546' => undef, # Calling DuckDuckGo
|
2015-10-14 13:40:47 -07:00
|
|
|
|
'(382) 538-2546' => undef,
|
2015-10-09 08:32:22 -07:00
|
|
|
|
'382-538-2546 x1234' => undef,
|
2015-10-14 13:40:47 -07:00
|
|
|
|
'1-382-538-2546' => undef,
|
2015-10-01 11:14:58 -07:00
|
|
|
|
'+1-(382)-538-2546' => undef,
|
2015-10-14 13:40:47 -07:00
|
|
|
|
'382.538.2546' => undef,
|
2015-10-12 12:21:36 -07:00
|
|
|
|
'+38-2538111111' => undef,
|
|
|
|
|
'+382538-111-111' => undef,
|
|
|
|
|
'+38 2538 111-111' => undef,
|
|
|
|
|
'01780-111-111' => undef,
|
|
|
|
|
'01780-111-111x400' => undef,
|
2015-10-14 13:40:47 -07:00
|
|
|
|
'(01780) 111 111' => undef,
|
2013-03-11 12:48:29 -07:00
|
|
|
|
);
|
|
|
|
|
|
2016-05-16 06:18:04 -07:00
|
|
|
|
done_testing;
|