diff --git a/share/goodie/conversions/conversions.js b/share/goodie/conversions/conversions.js index f905445754f..15490934e6a 100644 --- a/share/goodie/conversions/conversions.js +++ b/share/goodie/conversions/conversions.js @@ -129,6 +129,9 @@ DDH.conversions = DDH.conversions || {}; // CUSTOM LENGTH UNITS {name: 'nauticalmile', factor: '1.15078 miles'}, + {name: 'astronomicalunit', factor: '149597870700 meters'}, + {name: 'lightyear', factor: '9460730472580800 meters'}, + {name: 'parsec', factor: '30856775814913673 meters'}, // CUSTOM FORCE UNITS {name: 'kilonewton', factor: '1000 newton'}, @@ -151,7 +154,7 @@ DDH.conversions = DDH.conversions || {}; {name: 'carat', factor: '0.2 grams'}, {name: 'atomicmassunit', factor: '0.000000001660538921 femtograms'}, - // CUSTOM POWER UNIT + // CUSTOM POWER UNITS {name: 'kilowatt', factor: '1000 watt'}, {name: 'megawatt', factor: '1000 kilowatt'}, {name: 'gigawatt', factor: '1000 megawatt'}, @@ -162,13 +165,13 @@ DDH.conversions = DDH.conversions || {}; // CUSTOM PRESSURE UNITS {name: 'barye', factor: '0.000001 bar'}, {name: 'Satm', factor: '1 atm'}, - {name: 'at', factor:'0.980665 bar'}, + {name: 'at', factor: '0.980665 bar'}, {name: 'mbar', factor: '0.001 bar'}, - {name: 'cbar', factor:'0.01 bar'}, - {name: 'dbar', factor:'0.1 bar'}, - {name: 'kbar', factor:'1000 bar'}, - {name: 'Mbar', factor:'100000 bar'}, - {name: 'Gbar', factor:'100000000 bar'}, + {name: 'cbar', factor: '0.01 bar'}, + {name: 'dbar', factor: '0.1 bar'}, + {name: 'kbar', factor: '1000 bar'}, + {name: 'Mbar', factor: '100000 bar'}, + {name: 'Gbar', factor: '100000000 bar'}, // CUSTOM SPEED UNITS {name: 'knot', factor: '1.15078 mi/h'}, @@ -485,26 +488,29 @@ DDH.conversions = DDH.conversions || {}; length: { name: "Length", units: [ - { symbol: 'decameter', name: 'Decameter' }, - { symbol: 'millimeter', name: 'Millimeter' }, - { symbol: 'micrometer', name: 'Micrometer' }, - { symbol: 'micrometer', name: 'Micrometer' }, - { symbol: 'nanometer', name: 'Nanometer' }, - { symbol: 'picometer', name: 'Picometer' }, - { symbol: 'kilometer', name: 'Kilometer' }, - { symbol: 'meter', name: 'Meter' }, - { symbol: 'cm', name: 'Centimeter' }, - { symbol: 'hectometer', name: 'Hectometer' }, - { symbol: 'chains', name: 'Chains' }, - { symbol: 'inch', name: 'Inch' }, - { symbol: 'foot', name: 'Feet' }, - { symbol: 'yard', name: 'Yard' }, - { symbol: 'mile', name: 'Mile' }, - { symbol: 'nauticalmile', name: 'Nautical mile'}, - { symbol: 'link', name: 'Link' }, - { symbol: 'rod', name: 'Rod' }, - { symbol: 'angstrom', name: 'Angstrom' }, - { symbol: 'mil', name: 'Mil' }, + { symbol: 'decameter', name: 'Decameter' }, + { symbol: 'millimeter', name: 'Millimeter' }, + { symbol: 'micrometer', name: 'Micrometer' }, + { symbol: 'micrometer', name: 'Micrometer' }, + { symbol: 'nanometer', name: 'Nanometer' }, + { symbol: 'picometer', name: 'Picometer' }, + { symbol: 'kilometer', name: 'Kilometer' }, + { symbol: 'meter', name: 'Meter' }, + { symbol: 'cm', name: 'Centimeter' }, + { symbol: 'hectometer', name: 'Hectometer' }, + { symbol: 'chains', name: 'Chains' }, + { symbol: 'inch', name: 'Inch' }, + { symbol: 'foot', name: 'Feet' }, + { symbol: 'yard', name: 'Yard' }, + { symbol: 'mile', name: 'Mile' }, + { symbol: 'nauticalmile', name: 'Nautical mile'}, + { symbol: 'link', name: 'Link' }, + { symbol: 'rod', name: 'Rod' }, + { symbol: 'astronomicalunit', name: 'Astronomical unit'}, + { symbol: 'lightyear', name: 'Light year'}, + { symbol: 'parsec', name: 'Parsec'}, + { symbol: 'angstrom', name: 'Angstrom' }, + { symbol: 'mil', name: 'Mil' }, ], defaults: ['meter', 'cm'] }, @@ -523,9 +529,9 @@ DDH.conversions = DDH.conversions || {}; { symbol: 'hectogram', name: 'Hectogram'}, { symbol: 'megagram', name: 'Megagram'}, { symbol: 'ton', name: 'Ton' }, - { symbol: 'metricton', name: 'Metric Ton'}, - { symbol: 'longton', name: 'Long Ton'}, - { symbol: 'shortton', name: 'Short Ton'}, + { symbol: 'metricton', name: 'Metric Ton'}, + { symbol: 'longton', name: 'Long Ton'}, + { symbol: 'shortton', name: 'Short Ton'}, { symbol: 'grain', name: 'Grain' }, { symbol: 'dram', name: 'Dram' }, { symbol: 'ounce', name: 'Ounce' }, @@ -533,10 +539,10 @@ DDH.conversions = DDH.conversions || {}; { symbol: 'hundredweight', name: 'Hundredweight' }, { symbol: 'stick', name: 'Stick' }, { symbol: 'stone', name: 'Stone' }, - { symbol: 'metricquintal', name: 'Metric Quintal'}, - { symbol: 'usquintal', name: 'US Quintal'}, - { symbol: 'frenchquintal', name: 'French Quintal'}, - { symbol: 'troyounce', name: 'Troy Ounce'}, + { symbol: 'metricquintal', name: 'Metric Quintal'}, + { symbol: 'usquintal', name: 'US Quintal'}, + { symbol: 'frenchquintal', name: 'French Quintal'}, + { symbol: 'troyounce', name: 'Troy Ounce'}, { symbol: 'slug', name: 'Slug'}, { symbol: 'tola', name: 'Tola'}, { symbol: 'carat', name: 'Carat'}, diff --git a/share/goodie/conversions/triggers.yml b/share/goodie/conversions/triggers.yml index 0cfd61b645f..a04f028aada 100755 --- a/share/goodie/conversions/triggers.yml +++ b/share/goodie/conversions/triggers.yml @@ -433,11 +433,60 @@ symbols: [yd] --- aliases: - angstrom + - angstroms - ångström - - Å + - ångströms + - ångstrom + - ångstroms + - å type: length unit: angstrom --- +aliases: + - lightyear + - lightyears + - light year + - light years + - light-year + - light-years + - lichtjahr + - lichtjahre + - lichtjahren + - année-lumière + - années-lumière + - lichtjaar + - lichtjaren +type: length +unit: lightyear +symbols: [ly] +--- +aliases: + - astronomicalunit + - astronomicalunits + - astronomical unit + - astronomical units + - unité astronomique + - unités astronomiques + - astronomische einheit + - astronomische einheiten + - au + - aus + - ua +type: length +unit: astronomicalunit +symbols: [AU] +--- +aliases: + - parsec + - parsecs + - parallax second + - parallax seconds + - pc + - pcs +type: length +unit: parsec +symbols: [pc] +--- aliases: - ft - international foot diff --git a/t/Conversions.t b/t/Conversions.t index 4f59c3d6227..f3403fa39f2 100755 --- a/t/Conversions.t +++ b/t/Conversions.t @@ -436,6 +436,38 @@ ddg_goodie_test( physical_quantity => 'length' }) ), + '20000 ångströms to cm' => test_zci( + '', structured_answer => make_answer({ + raw_input => '20000', + from_unit => 'angstrom', + to_unit => 'cm', + physical_quantity => 'length' + }) + ), + '1 light-year in nanometres' => test_zci( + '', structured_answer => make_answer({ + raw_input => '1', + from_unit => 'lightyear', + to_unit => 'nanometer', + physical_quantity => 'length' + }) + ), + '0.1 astronomische einheit in kilometer' => test_zci( + '', structured_answer => make_answer({ + raw_input => '0.1', + from_unit => 'astronomicalunit', + to_unit => 'kilometer', + physical_quantity => 'length' + }) + ), + '12 parsecs in light years' => test_zci( + '', structured_answer => make_answer({ + raw_input => '12', + from_unit => 'parsec', + to_unit => 'lightyear', + physical_quantity => 'length' + }) + ), # TEMPERATURE '1 degree fahrenheit to celsius' => test_zci( '',