Template talk:Convert
Latest comment: 11 years ago by Johnuniq
An overview is at Module talk:Convert#Overview.
Examples
editConversions with an input like 6|ft|5|in
, and large scale units like e3km
, are not yet implemented. The only other fails are minor disagreements, although the checks on this page are ignoring whitespace differences which will need to be sorted out later. Johnuniq (talk) 07:48, 7 February 2013 (UTC)
Single value
editTest | Result | Expected Result | Status |
---|---|---|---|
{{convert|3210|g}} | 3,210 grams (113 oz) | 3,210 grams (113 oz) | Pass |
{{convert|321|dag}} | 321 decagrams (113 oz) | ||
{{convert|32.1|hg}} | 32.1 hectograms (113 oz) | ||
{{convert|3.21|kg}} | 3.21 kilograms (7.1 lb) | 3.21 kilograms (7.1 lb) | Pass |
{{convert|3210|g|oz}} | 3,210 grams (113 oz) | 3,210 grams (113 oz) | Pass |
{{convert|321|dag|oz}} | 321 decagrams (113 oz) | ||
{{convert|32.1|hg|oz}} | 32.1 hectograms (113 oz) | ||
{{convert|3.21|kg|oz}} | 3.21 kilograms (113 oz) | 3.21 kilograms (113 oz) | Pass |
{{convert|3210|g|lb}} | 3,210 grams (7.08 lb) | 3,210 grams (7.1 lb) | Fail |
{{convert|321|dag|lb}} | 321 decagrams (7.08 lb) | ||
{{convert|32.1|hg|lb}} | 32.1 hectograms (7.1 lb) | ||
{{convert|3.21|kg|lb}} | 3.21 kilograms (7.1 lb) | 3.21 kilograms (7.1 lb) | Pass |
{{convert|3.21|kg|lb|0}} | 3.21 kilograms (7 lb) | 3.21 kilograms (7 lb) | Pass |
{{convert|954|Mg|lb}} | 954 megagrams (2,103,000 lb) | 954 megagrams (2,100,000 lb) | Fail |
{{convert|954|Mg|ton}} | 954 megagrams (939 long tons; 1,052 short tons) | 954 megagrams (939 long tons; 1,052 short tons) | Pass |
{{convert|10|kg|lb|disp=or}} | 10 kilograms or 22 pounds | 10 kilograms or 22 pounds | Pass |
{{convert|6|ft|5|in|m}} | 6 feet 5 inches (1.96 m) | 6 feet 5 inches (1.96 m) | Pass |
{{convert|2|m|ftin}} | 2 metres (6 ft 7 in) | 2 metres (6 ft 7 in) | Pass |
{{convert|7135286|nm}} | 7,135,286 nanometres (0.2809168 in) | 7,135,286 nanometres (0.2809168 in) | Pass |
{{convert|170135286|nm}} | 170,135,286 nanometres (6.6982396 in) | 170,135,286 nanometres (6.6982396 in) | Pass |
{{convert|170135.286|um}} | 170,135.286 micrometres (6.6982396 in) | 170,135.286 micrometres (6.6982396 in) | Pass |
{{convert|170.135286|mm}} | 170.135286 millimetres (6.6982396 in) | 170.135286 millimetres (6.6982396 in) | Pass |
{{convert|17.0135286|cm}} | 17.0135286 centimetres (6.6982396 in) | 17.0135286 centimetres (6.6982396 in) | Pass |
{{convert|1.70135286|dm}} | 1.70135286 decimetres (6.6982396 in) | 1.70135286 decimetres (6.6982396 in) | Pass |
{{convert|1876490|m}} | 1,876,490 metres (6,156,460 ft) | 1,876,490 metres (6,156,460 ft) | Pass |
{{convert|187649.0|dam}} | 187,649.0 decametres (6,156,463 ft) | 187,649.0 decametres (6,156,463 ft) | Pass |
{{convert|18764.90|Hm}} | 18,764.90 Hm[convert: unknown unit] | ||
{{convert|1876.490|km}} | 1,876.490 kilometres (1,165.997 mi) | 1,876.490 kilometres (1,165.997 mi) | Pass |
{{convert|1.876490|Mm}} | 1.876490 megametres (1,165.997 mi) | 1.876490 megametres (1,165.997 mi) | Pass |
{{convert|7135286|nm|in}} | 7,135,286 nanometres (0.2809168 in) | 7,135,286 nanometres (0.2809168 in) | Pass |
{{convert|170135286|nm|in}} | 170,135,286 nanometres (6.6982396 in) | 170,135,286 nanometres (6.6982396 in) | Pass |
{{convert|170135.286|um|in}} | 170,135.286 micrometres (6.6982396 in) | 170,135.286 micrometres (6.6982396 in) | Pass |
{{convert|170.135286|mm|in}} | 170.135286 millimetres (6.6982396 in) | 170.135286 millimetres (6.6982396 in) | Pass |
{{convert|17.0135286|cm|in}} | 17.0135286 centimetres (6.6982396 in) | 17.0135286 centimetres (6.6982396 in) | Pass |
{{convert|1.70135286|dm|in}} | 1.70135286 decimetres (6.6982396 in) | 1.70135286 decimetres (6.6982396 in) | Pass |
{{convert|170|mm|in}} | 170 millimetres (6.7 in) | 170 millimetres (6.7 in) | Pass |
{{convert|17|cm|in}} | 17 centimetres (6.7 in) | 17 centimetres (6.7 in) | Pass |
{{convert|1.7|dm|in}} | 1.7 decimetres (6.7 in) | 1.7 decimetres (6.7 in) | Pass |
{{convert|1729|m|ft}} | 1,729 metres (5,673 ft) | 1,729 metres (5,673 ft) | Pass |
{{convert|172.9|dam|ft}} | 172.9 decametres (5,670 ft) | 172.9 decametres (5,670 ft) | Pass |
{{convert|17.29|Hm|ft}} | 17.29 Hm[convert: unknown unit] | ||
{{convert|1.729|km|ft}} | 1.729 kilometres (5,670 ft) | 1.729 kilometres (5,670 ft) | Pass |
{{convert|1729|m|yd}} | 1,729 metres (1,891 yd) | 1,729 metres (1,891 yd) | Pass |
{{convert|172.9|dam|yd}} | 172.9 decametres (1,891 yd) | 172.9 decametres (1,891 yd) | Pass |
{{convert|17.29|Hm|yd}} | 17.29 Hm[convert: unknown unit] | ||
{{convert|1.729|km|yd}} | 1.729 kilometres (1,891 yd) | 1.729 kilometres (1,891 yd) | Pass |
{{convert|1876490|m|mi}} | 1,876,490 metres (1,166.00 mi) | 1,876,490 metres (1,166.00 mi) | Pass |
{{convert|1876490|m|nmi}} | 1,876,490 metres (1,013.22 nmi) | 1,876,490 metres (1,013.22 nmi) | Pass |
{{convert|18764.90|Hm|yd}} | 18,764.90 Hm[convert: unknown unit] | ||
{{convert|18764.90|Hm|mi}} | 18,764.90 Hm[convert: unknown unit] | ||
{{convert|18764.90|Hm|nmi}} | 18,764.90 Hm[convert: unknown unit] | ||
{{convert|1876.490|km|yd}} | 1,876.490 kilometres (2,052,154 yd) | 1,876.490 kilometres (2,052,154 yd) | Pass |
{{convert|1876.490|km|mi}} | 1,876.490 kilometres (1,165.997 mi) | 1,876.490 kilometres (1,165.997 mi) | Pass |
{{convert|1876.490|km|nmi}} | 1,876.490 kilometres (1,013.224 nmi) | 1,876.490 kilometres (1,013.224 nmi) | Pass |
{{convert|1.876490|Mm|yd}} | 1.876490 megametres (2,052,154 yd) | 1.876490 megametres (2,052,154 yd) | Pass |
{{convert|1.876490|Mm|mi}} | 1.876490 megametres (1,165.997 mi) | 1.876490 megametres (1,165.997 mi) | Pass |
{{convert|1.876490|Mm|nmi}} | 1.876490 megametres (1,013.224 nmi) | 1.876490 megametres (1,013.224 nmi) | Pass |
{{convert|10|mi}} | 10 miles (16 km) | 10 miles (16 km) | Pass |
{{convert|100|mpgus}} | 100 miles per US gallon (2.4 L/100 km; 120 mpg-imp) | 100 miles per US gallon (2.4 L/100 km; 120 mpg-imp) | Fail |
{{convert|2|m/s}} | 2 metres per second (6.6 ft/s) | 2 metres per second (6.6 ft/s) | Pass |
{{convert|120|km/h}} | 120 kilometres per hour (75 mph) | 120 kilometres per hour (75 mph) | Pass |
{{convert|18|°C|°F}} | 18 °C (64 °F) | 18 °C (64 °F) | Pass |
{{convert|400|a|acre}} | 400 ares (9.9 acres) | ||
{{convert|9|ha|acre}} | 9 hectares (22 acres) | 9 hectares (22 acres) | Pass |
{{convert|76|mL|floz}} | 76 millilitres (2.7 imp fl oz; 2.6 US fl oz) | 76 millilitres (2.7 imp fl oz; 2.6 US fl oz) | Pass |
{{convert|1250|sqft|m2|lk=in|sigfig=2}} | 1,250 square feet (120 m2) Note 'lk=in' links only the input unit. | ||
{{convert|20.5|m3|cuyd|lk=out|abbr=on}} | 20.5 m3 (26.8 cu yd) Note 'lk=out' links only the output unit, cu yd. | ||
{{convert|641|acre|ha sqmi|lk=on}} | 641 acres (259 ha; 1.002 sq mi) Note 'lk=on' links all units. | ||
{{convert|641|acre|ha sqmi|2|lk=on}} | 641 acres (259.40 ha; 1.00 sq mi) Although 640 acres equals 1 square mile; 641 acres rounded to two decimal places equals 1.00 sq mi. |
Range of 2 values
edit- The first "Fail" result below is due to an error in the old template. The correct conversion is 41–50 °F (278–283 K).
- The second "Fail" result below is not correct. The actual result matches the old template, which gives "(200 ft × 390 ft)" with a repeated abbreviated unit when "×" is used. I haven't patched the expected result because it might be worth wondering why the expected result is different from how the old template currently works. Johnuniq (talk) 07:34, 6 February 2013 (UTC)
Test | Result | Expected Result | Status |
---|---|---|---|
{{convert|60|and|170|kg|lb}} | 60 and 170 kilograms (130 and 370 lb) | 60 and 170 kilograms (130 and 370 lb) | Pass |
{{convert|60|to|170|kg|lb}} | 60 to 170 kilograms (130 to 370 lb) | 60 to 170 kilograms (130 to 370 lb) | Pass |
{{convert|60|to(-)|170|kg|lb}} | 60 to 170 kilograms (130–370 lb) | 60 to 170 kilograms (130–370 lb) | Pass |
{{convert|60|-|170|kg|lb}} | 60–170 kilograms (130–370 lb) | 60–170 kilograms (130–370 lb) | Pass |
{{convert|41|to|50|F|C}} | 41 to 50 °F (5 to 10 °C) | 41 to 50 °F (5 to 10 °C) | Pass |
{{convert|41|-|50|F|K}} | 41–50 °F (278–283 K) | 41–50 °F (278–326 K) | Fail |
{{convert|60|x|120|m|ft}} | 60 by 120 metres (200 ft × 390 ft) | 60 by 120 metres (200 × 390 ft) | Fail |
{{convert|60|+/-|10|m|ft}} | 60 ± 10 metres (197 ± 33 ft) | 60 ± 10 metres (200 ± 33 ft) | Fail |
{{convert|19|to|27|L|USgal}} | 19 to 27 litres (5.0 to 7.1 US gal) | 19 to 27 litres (5.0 to 7.1 US gal) | Pass |
{{convert|5|to|7|L|USgal|abbr=mos}} | 5 litres to 7 litres (1.3 to 1.8 US gal) | 5 litres to 7 litres (1.3 to 1.8 US gal) | Pass |
{{convert|4|-|9|L|USgal|abbr=off}} | 4–9 litres (1.1–2.4 US gallons) | 4–9 litres (1.1–2.4 US gallons) | Pass |
Named param tests
editTest | Result | Expected Result | Status |
---|---|---|---|
{{convert|3.21|ft|cm}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
{{convert|3.21|ft|cm|lk=on}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
{{convert|3.21|ft|cm|lk=in}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
{{convert|3.21|ft|cm|lk=out}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
{{convert|3.21|ft|cm|adj=on}} | 3.21-foot (98 cm) | 3.21-foot (98 cm) | Pass |
{{convert|3.21|ft|cm|adj=mid|bridge}} | 3.21-foot bridge (98 cm) | 3.21-foot bridge (98 cm) | Pass |
{{convert|3.21|ft|cm|abbr=on}} | 3.21 ft (98 cm) | 3.21 ft (98 cm) | Pass |
{{convert|3.21|ft|cm|abbr=off}} | 3.21 feet (98 centimetres) | 3.21 feet (98 centimetres) | Pass |
{{convert|3.21|ft|cm|abbr=in}} | 3.21 ft (98 centimetres) | 3.21 ft (98 centimetres) | Pass |
{{convert|3.21|ft|cm|abbr=out}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
{{convert|3.21|ft|cm|abbr=values}} | 3.21 (98) | 3.21 (98) | Pass |
{{convert|3.21|ft|cm|disp=x| (begin | end)}} | 3.21 feet (begin 98 cm end) | 3.21 feet (begin 98 cm end) | Pass |
{{convert|3.21|ft|cm|disp=output only}} | 98 cm | 98 cm | Pass |
{{convert|3.21|ft|cm|disp=output number only}} | 98 | 98 | Pass |
{{convert|3.21|ft|cm|disp=number}} | 98 | 98 | Pass |
{{convert|3.21|ft|cm|disp=flip}} | 98 centimetres (3.21 ft) | 98 centimetres (3.21 ft) | Pass |
{{convert|3.21|ft|cm|disp=unit}} | feet | feet | Pass |
{{convert|3.21|ft|cm|disp=u2}} | cm* | cm | Fail |
{{convert|3.21|ft|cm|disp=comma}} | 3.21 feet, 98 cm | 3.21 feet, 98 cm | Pass |
{{convert|3.21|ft|cm|disp=sqbr}} | 3.21 feet [98 cm] | 3.21 feet [98 cm] | Pass |
{{convert|3.21|ft|cm|disp=or}} | 3.21 feet or 98 centimetres | 3.21 feet or 98 centimetres | Pass |
{{convert|3.21|ft|cm|disp=slash}} | 3.21 feet or 98 centimetres* | 3.21 feet / 98 centimetres | Fail |
{{convert|3.21|ft|cm|disp=s}} | 3.21 feet or 98 centimetres* | 3.21 feet / 98 centimetres | Fail |
{{convert|1|cuyd|disp=unit}} | cubic yard | cubic yard | Pass |
{{convert|2|cuyd|disp=unit}} | cubic yards | cubic yards | Pass |
{{convert|3.21|ft|cm|disp=5}} | 3.21 feet (100 cm) | 3.21 feet (100 cm) | Pass |
{{convert|3.21|ft|cm|sigfig=5}} | 3.21 feet (97.841 cm) | 3.21 feet (97.841 cm) | Pass |
{{convert|3.21|ft|cm}} | 3.21 feet (98 cm) | 3.21 feet (98 cm) | Pass |
Fractions demo
editNormal fractions.
{{convert|3/8|m|mm|2}} | 3⁄8 metre (375.00 mm) |
{{convert|-3/8|m|mm|2}} | −3⁄8 metre (−375.00 mm) |
{{convert|5+3/8|m|mm|2}} | 5 3⁄8 metres (5,375.00 mm) |
{{convert|-5-3/8|m|mm|2}} | −5 3⁄8 metres (−5,375.00 mm) |
{{convert|3/8|in|mm|3|abbr=on}} | 3⁄8 in (9.525 mm) |
{{convert|4+3/8|in|mm|2|abbr=on}} | 4 3⁄8 in (111.13 mm) |
{{convert|-5-3/8|in|mm|2|abbr=on}} | −5 3⁄8 in (−136.53 mm) |
Strange fractions.
{{convert|5-3/8|m|mm|2}} | [convert: invalid number] |
{{convert|-5+3/8|m|mm|2}} | [convert: invalid number] |
{{convert|1-17.5/5|m|mm|2}} | [convert: invalid number] |
{{convert|-1+17.5/5|m|mm|2}} | [convert: invalid number] |
{{convert|-125e-2+.175e+2/5000e-3|m|mm|2}} | [convert: invalid number] |