Merge pull request #2737 from duckduckgo/mintsoft/conversions/speed

Conversions: now supports speed!
master
Zaahir Moolla 2016-04-01 15:44:09 -04:00
commit ed9ed29bba
3 changed files with 145 additions and 0 deletions

View File

@ -47,6 +47,10 @@ my %plural_exceptions = (
'electrical horsepower' => 'electrical horsepower',
'pounds force' => 'pounds force',
'坪' => '坪',
'km/h' => 'km/h',
'mph' => 'mph',
'm/s' => 'm/s',
'ft/s' => 'ft/s',
);
my %singular_exceptions = reverse %plural_exceptions;

View File

@ -1277,3 +1277,58 @@ aliases:
factor: 1.03397576569129e-25
type: digital
unit: yobibyte
---
aliases:
- mi/h
- miles per hour
- mile per hour
factor: 2.237
type: speed
unit: mph
---
aliases:
- meters per second
- metres per second
- meter per second
- metre per second
- meter/second
- metre/second
- meters/second
- metres/second
- mps
factor: 1
type: speed
unit: m/s
---
aliases:
- feet per second
- foot per second
- feet/sec
- feet/second
- foot/sec
- foot/second
- fps
- ft/sec
- ft/second
factor: 3.281
type: speed
unit: ft/s
---
aliases:
- kilometer per hour
- kilometre per hour
- kph
- kmph
- kilometers per hour
- kilometres per hour
factor: 3.6
type: speed
unit: km/h
---
aliases:
- knots
- kt
- nmi/h
factor: 1.944
type: speed
unit: knot

View File

@ -2527,6 +2527,92 @@ ddg_goodie_test(
physical_quantity => 'digital'
})
),
'50 mph in kph' => test_zci(
'50 mph = 80.465 km/h',
structured_answer => make_answer({
markup_input => '50',
raw_input => '50',
from_unit => 'mph',
styled_output => '80.465',
raw_answer => '80.465',
to_unit => 'km/h',
physical_quantity => 'speed'
})
),
'10 metres per second to feet per second' => test_zci(
'10 m/s = 32.810 ft/s',
structured_answer => make_answer({
markup_input => '10',
raw_input => '10',
from_unit => 'm/s',
styled_output => '32.810',
raw_answer => '32.810',
to_unit => 'ft/s',
physical_quantity => 'speed'
})
),
'10 km/h to mph' => test_zci(
'10 km/h = 6.214 mph',
structured_answer => make_answer({
markup_input => '10',
raw_input => '10',
from_unit => 'km/h',
styled_output => '6.214',
raw_answer => '6.214',
to_unit => 'mph',
physical_quantity => 'speed'
})
),
'1 km/h to mph' => test_zci(
'1 km/h = 0.621 mph',
structured_answer => make_answer({
markup_input => '1',
raw_input => '1',
from_unit => 'km/h',
styled_output => '0.621',
raw_answer => '0.621',
to_unit => 'mph',
physical_quantity => 'speed'
})
),
'0.6214 mph to kph' => test_zci(
'0.6214 mph = 1 km/h',
structured_answer => make_answer({
markup_input => '0.6214',
raw_input => '0.6214',
from_unit => 'mph',
styled_output => '1',
raw_answer => '1',
to_unit => 'km/h',
physical_quantity => 'speed'
})
),
'1 mps in mph' => test_zci(
'1 m/s = 2.237 mph',
structured_answer => make_answer({
markup_input => '1',
raw_input => '1',
from_unit => 'm/s',
styled_output => '2.237',
raw_answer => '2.237',
to_unit => 'mph',
physical_quantity => 'speed'
})
),
'1 ft/s in m/s' => test_zci(
'1 ft/s = 0.305 m/s',
structured_answer => make_answer({
markup_input => '1',
raw_input => '1',
from_unit => 'ft/s',
styled_output => '0.305',
raw_answer => '0.305',
to_unit => 'm/s',
physical_quantity => 'speed'
})
),
# Intentionally untriggered
'5 inches in 5 meters' => undef,