diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f9792..45248d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## [5.5.0](https://github.com/shivam091/unit_measurements/compare/v5.4.1...v5.5.0) - 2023-10-29 + +### What's new + +- Added new units `ipm/s`, `iph/s`, `mi/s²`, `mpm/s`, `mph/s`, `fpm/s`, `fph/s`, `Gal` in acceleration. +- Added new units `mi/s`, `mi/min`, `mi/h`, and `fur/ftn` in velocity. +- Added new units `lnk²`, `ac`, `ft²`, `mi²`, `ch²`, `bd`, and `ro` in area. + +### What's updated + +- Changed unit name `rod²` to `rd²` along with its aliases. + +---------- + ## [5.4.1](https://github.com/shivam091/unit_measurements/compare/v5.4.0...v5.4.1) - 2023-10-28 ### What's updated diff --git a/Gemfile.lock b/Gemfile.lock index 3779c4e..6275e59 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - unit_measurements (5.4.1) + unit_measurements (5.5.0) activesupport (~> 7.0) GEM diff --git a/lib/unit_measurements/unit_groups/acceleration.rb b/lib/unit_measurements/unit_groups/acceleration.rb index 539b073..0dda23a 100644 --- a/lib/unit_measurements/unit_groups/acceleration.rb +++ b/lib/unit_measurements/unit_groups/acceleration.rb @@ -11,13 +11,25 @@ system :imperial do unit "in/s²", value: "0.0254 m/s²", aliases: ["in/s^2", "in·s⁻²", "ips²", "inch per second squared", "inches per second squared"] + unit "ipm/s", value: "0.0004233333 m/s²", aliases: ["in/(min⋅s)", "inch per minute per second", "inches per minute per second"] + unit "iph/s", value: "7.055555e-6 m/s²", aliases: ["in/(h⋅s)", "inch per hour per second", "inches per hour per second"] + + unit "mi/s²", value: "1609.344 m/s²", aliases: ["mi/s^2", "mi·s⁻²", "mps²", "mile per second squared", "miles per second squared"] + unit "mpm/s", value: "26.8224 m/s²", aliases: ["mi/(min⋅s)", "mile per minute per second", "miles per minute per second"] + unit "mph/s", value: "0.44704 m/s²", aliases: ["mi/(h⋅s)", "mile per hour per second", "miles per hour per second"] end system :foot_pound_second do unit "ft/s²", value: "0.3048 m/s²", aliases: ["ft/s^2", "ft·s⁻²", "fps²", "foot per second squared", "feet per second squared"] + unit "fpm/s", value: "0.00508 m/s²", aliases: ["ft/(min⋅s)", "foot per minute per second", "feet per minute per second"] + unit "fph/s", value: "8.466667e-5 m/s²", aliases: ["ft/(h⋅s)", "foot per hour per second", "feet per hour per second"] end system :meteorology_aviation_maritime do unit "Kn/s", value: "0.5144444 m/s²", aliases: ["knot per second", "knots per second"] end + + system :centimetre_gram_second do + unit "Gal", value: "1e-2 m/s²", aliases: ["gal", "galileo"] + end end diff --git a/lib/unit_measurements/unit_groups/area.rb b/lib/unit_measurements/unit_groups/area.rb index f3de849..c8a8a69 100644 --- a/lib/unit_measurements/unit_groups/area.rb +++ b/lib/unit_measurements/unit_groups/area.rb @@ -9,18 +9,33 @@ unit "a", value: "100 m²", aliases: ["are", "ares"] unit "b", value: "1e-28 m²", aliases: ["barn", "barns"] unit "m²", aliases: ["m^2", "sq m", "square meter", "square meters", "square metre", "square metres"] + unit "ha", value: "10000 m²", aliases: ["hectare", "hectares"] unit "km²", value: "1e+6 m²", aliases: ["km^2", "sq km", "square kilometer", "square kilometers", "square kilometre", "square kilometres"] end system :imperial do unit "ac", value: "4046.8564224 m²", aliases: ["acre", "acres"] + unit "in²", value: "0.00064516 m²", aliases: ["in^2", "sq in", "square inch", "square inches"] unit "ft²", value: "144 in²", aliases: ["ft^2", "sq ft", "square foot", "square feet"] unit "yd²", value: "9 ft²", aliases: ["yd^2", "sq yd", "square yard", "square yards"] unit "mi²", value: "3097600 yd²", aliases: ["mi^2", "sq mi", "square mile", "square miles"] unit "ch²", value: "484 yd²", aliases: ["ch^2", "sq ch", "square chain", "square chains"] + unit "rd²", value: "272 1/4 ft²", aliases: ["rd^2", "sq rd", "square rod", "square rods"] + unit "fur²", value: "48400 yd²", aliases: ["fur^2", "sq fur", "square furlong", "square furlongs"] - unit "rod²", value: "272 1/4 ft²", aliases: ["rod^2", "sq rod", "square rod", "square rods"] + unit "lnk²", value: "4.0468564224e-2 m²", aliases: ["link^2", "sq lnk", "square link", "square links"] end + + system :us_customary do + unit "ac (US)", value: "4046.873 m²", aliases: ["acre (US)", "acres (US)"] + + unit "ft² (US)", value: "0.09290341161327482 m²", aliases: ["ft^2 (US)", "sq ft (US)", "square foot (US)", "square feet (US)"] + unit "mi² (US)", value: "2.58999847e+6 m²", aliases: ["mi^2 (US)", "sq mi (US)", "square mile (US)", "square miles (US)"] + unit "ch² (US)", value: "404.6873 m²", aliases: ["ch^2 (US)", "sq ch (US)", "square chain (US)", "square chains (US)"] + end + + unit "bd", value: "0.00774192 m²", aliases: ["board", "boards"] + unit "ro", value: "1/4 ac", aliases: ["rood"] end diff --git a/lib/unit_measurements/unit_groups/velocity.rb b/lib/unit_measurements/unit_groups/velocity.rb index c45d06d..faa1f7e 100644 --- a/lib/unit_measurements/unit_groups/velocity.rb +++ b/lib/unit_measurements/unit_groups/velocity.rb @@ -15,6 +15,10 @@ unit "in/s", value: "0.0254 m/s", aliases: ["in·s⁻¹", "ips", "inch per second", "inches per second"] unit "in/min", value: "1/60 in/s", aliases: ["in·min⁻¹", "ipm", "inch per minute", "inches per minute"] unit "in/h", value: "1/60 in/min", aliases: ["in·h⁻¹", "iph", "inch per hour", "inches per hour"] + + unit "mi/s", value: "1609.344 m/s", aliases: ["mi·s⁻¹", "mps", "mile per second", "miles per second"] + unit "mi/min", value: "1/60 mi/s", aliases: ["mi·min⁻¹", "mpm", "mile per minute", "miles per minute"] + unit "mi/h", value: "1/60 mi/min", aliases: ["mi·h⁻¹", "mph", "mile per hour", "miles per hour"] end system :foot_pound_second do @@ -23,6 +27,10 @@ unit "ft/h", value: "1/60 ft/min", aliases: ["ft·h⁻¹", "fph", "foot per hour", "feet per hour"] end + system :furlong_firkin_fortnight do + unit "fur/ftn", value: "1.663e-4 m/s", aliases: ["fur·ftn⁻¹", "furlong per fortnight", "furlongs per fortnight"] + end + system :meteorology_aviation_maritime do unit "Kn", value: "0.514773 m/s", aliases: ["kt", "knot", "knots"] end diff --git a/lib/unit_measurements/version.rb b/lib/unit_measurements/version.rb index 644f24d..389072f 100644 --- a/lib/unit_measurements/version.rb +++ b/lib/unit_measurements/version.rb @@ -4,5 +4,5 @@ module UnitMeasurements # Current stable version. - VERSION = "5.4.1" + VERSION = "5.5.0" end diff --git a/spec/unit_measurements/unit_groups/acceleration_spec.rb b/spec/unit_measurements/unit_groups/acceleration_spec.rb index 676c2b6..104b308 100644 --- a/spec/unit_measurements/unit_groups/acceleration_spec.rb +++ b/spec/unit_measurements/unit_groups/acceleration_spec.rb @@ -5,17 +5,97 @@ # spec/unit_measurements/unit_groups/acceleration_spec.rb RSpec.describe UnitMeasurements::Acceleration do + describe "Gal" do + subject { described_class.new(2, "Gal") } + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(0.02) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(0.78740157480315) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(47.2440982081967) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(2834.6458924918) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(0.0656167979002625) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(3.93700787401575) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(236.220463140927) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(1.24274238447467e-5) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.000745645430684801) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(0.044738725841088) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(0.038876893207507) + end + end + describe "m/s²" do subject { described_class.new(2, "m/s²") } + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(200) + end + it "converts to in/s²" do expect(subject.convert_to("in/s²").quantity).to eq(78.740157480315) end + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(4724.40982081967) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(2.8346458924918e+5) + end + it "converts to ft/s²" do expect(subject.convert_to("ft/s²").quantity).to eq(6.56167979002625) end + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(393.700787401575) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(23622.0463140927) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(0.00124274238447467) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.0745645430684801) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(4.4738725841088) + end + it "converts to Kn/s" do expect(subject.convert_to("Kn/s").quantity).to eq(3.8876893207507) end @@ -24,22 +104,154 @@ describe "in/s²" do subject { described_class.new(2, "in/s²") } + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(5.08) + end + it "converts to m/s²" do expect(subject.convert_to("m/s²").quantity).to eq(0.0508) end + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(120.00000944882) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(7200.00056692918) + end + it "converts to ft/s²" do expect(subject.convert_to("ft/s²").quantity).to eq(0.166666666666667) end + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(10) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(599.999976377954) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(3.15656565656566e-5) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.00189393939393939) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(0.113636363636364) + end + it "converts to Kn/s" do expect(subject.convert_to("Kn/s").quantity).to eq(0.0987473087470677) end end + describe "ipm/s" do + subject { described_class.new(2, "ipm/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(0.08466666) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(0.0008466666) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(0.0333333307086614) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(120.0) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(0.00277777755905512) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(0.166666653543307) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(9.99999881889769) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(5.2609423466953e-7) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(3.15656540801718e-5) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(0.00189393924481031) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(0.00164578834952815) + end + end + + describe "iph/s" do + subject { described_class.new(2, "iph/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(0.001411111) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(1.411111e-05) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(0.000555555511811024) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(0.0333333333333333) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(4.62962926509186e-5) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(0.00277777755905512) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(0.166666646981628) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(8.76823724449216e-9) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(5.2609423466953e-7) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(3.15656540801718e-5) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(2.74298058254692e-5) + end + end + describe "ft/s²" do subject { described_class.new(2, "ft/s²") } + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(60.96) + end + it "converts to m/s²" do expect(subject.convert_to("m/s²").quantity).to eq(0.6096) end @@ -48,14 +260,286 @@ expect(subject.convert_to("in/s²").quantity).to eq(24) end + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(1440.00011338584) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(86400.0068031501) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(120) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(7199.99971653544) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(0.000378787878787879) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.0227272727272727) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(1.36363636363636) + end + it "converts to Kn/s" do expect(subject.convert_to("Kn/s").quantity).to eq(1.18496770496481) end end + describe "fph/s" do + subject { described_class.new(2, "fph/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(0.016933334) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(0.00016933334) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(0.00666666692913386) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(0.400000047244098) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(24.0000028346459) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(0.000555555577427821) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(0.0333333346456693) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(1.0521885936133e-7) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(6.31313156167979e-6) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(0.000378787893700787) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(0.000329157708782523) + end + end + + describe "fpm/s" do + subject { described_class.new(2, "fpm/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(1.016) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(0.01016) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(0.4) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(24.0000018897639) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(1440.00011338584) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(0.0333333333333333) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(119.999995275591) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(6.31313131313131e-6) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.000378787878787879) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(0.0227272727272727) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(0.0197494617494135) + end + end + + describe "mi/s²" do + subject { described_class.new(2, "mi/s²") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(3.218688e+5) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(3218.688) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(1.2672e+5) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(7.60320059867721e+6) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(4.56192035920633e+8) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(10560) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(6.336e+5) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(3.80159985033071e+7) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(120) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(7200) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(6256.62948221421) + end + end + + describe "mph/s" do + subject { described_class.new(2, "mph/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(89.408) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(0.89408) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(35.2) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(2112.00016629923) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(1.26720009977954e+5) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(2.93333333333333) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(176) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(10559.999584252) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(0.000555555555555556) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.0333333333333333) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(1.73795263394839) + end + end + + describe "mpm/s" do + subject { described_class.new(2, "mpm/s") } + + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(5364.48) + end + + it "converts to m/s²" do + expect(subject.convert_to("m/s²").quantity).to eq(53.6448) + end + + it "converts to in/s²" do + expect(subject.convert_to("in/s²").quantity).to eq(2112) + end + + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(1.26720009977954e+5) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(7.60320059867721e+6) + end + + it "converts to ft/s²" do + expect(subject.convert_to("ft/s²").quantity).to eq(176) + end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(10560) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(6.33599975055119e+5) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(0.0333333333333333) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(120) + end + + it "converts to Kn/s" do + expect(subject.convert_to("Kn/s").quantity).to eq(104.277158036903) + end + end + describe "Kn/s" do subject { described_class.new(2, "Kn/s") } + it "converts to Gal" do + expect(subject.convert_to("Gal").quantity).to eq(102.88888) + end + it "converts to m/s²" do expect(subject.convert_to("m/s²").quantity).to eq(1.0288888) end @@ -64,8 +548,36 @@ expect(subject.convert_to("in/s²").quantity).to eq(40.5074330708661) end + it "converts to ipm/s" do + expect(subject.convert_to("ipm/s").quantity).to eq(2430.44617562568) + end + + it "converts to iph/s" do + expect(subject.convert_to("iph/s").quantity).to eq(1.45826770537541e+5) + end + it "converts to ft/s²" do expect(subject.convert_to("ft/s²").quantity).to eq(3.37561942257218) end + + it "converts to fpm/s" do + expect(subject.convert_to("fpm/s").quantity).to eq(202.537165354331) + end + + it "converts to fph/s" do + expect(subject.convert_to("fph/s").quantity).to eq(12152.2294428256) + end + + it "converts to mi/s²" do + expect(subject.convert_to("mi/s²").quantity).to eq(0.00063932186033564) + end + + it "converts to mpm/s" do + expect(subject.convert_to("mpm/s").quantity).to eq(0.0383593116201384) + end + + it "converts to mph/s" do + expect(subject.convert_to("mph/s").quantity).to eq(2.3015586972083) + end end end diff --git a/spec/unit_measurements/unit_groups/area_spec.rb b/spec/unit_measurements/unit_groups/area_spec.rb index c2a5d9e..d7db99c 100644 --- a/spec/unit_measurements/unit_groups/area_spec.rb +++ b/spec/unit_measurements/unit_groups/area_spec.rb @@ -52,8 +52,36 @@ expect(subject.convert_to("fur²").quantity).to eq(4.94210762934331e-5) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(0.0790737220694929) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.0790737220694929) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(258.333850001033) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.00197684305173732) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(49.4210762934331) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.000494208738450651) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(21.5277347222222) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(7.72201228365977e-7) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.00494208738450651) end end @@ -104,8 +132,36 @@ expect(subject.convert_to("fur²").quantity).to eq(0.00494210762934331) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(7.90737220694929) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(7.90737220694929) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(25833.3850001033) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.197684305173732) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4942.10762934331) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.0494208738450651) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(2152.77347222222) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(7.72201228365977e-5) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.494208738450651) end end @@ -156,8 +212,36 @@ expect(subject.convert_to("fur²").quantity).to eq(4.94210762934331e-33) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(7.90737220694929e-30) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(7.90737220694929e-30) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(2.58333850001033e-26) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(1.97684305173732e-31) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4.94210762934331e-27) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(4.94208738450651e-32) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(2.15277347222222e-27) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(7.72201228365977e-35) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(4.94208738450651e-31) end end @@ -208,8 +292,36 @@ expect(subject.convert_to("fur²").quantity).to eq(0.494210762934331) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(790.737220694929) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(790.737220694929) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(2.58333850001033e+6) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(19.7684305173732) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4.94210762934331e+5) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(4.94208738450651) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(2.15277347222222e+5) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.00772201228365977) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(49.4208738450651) end end @@ -260,8 +372,36 @@ expect(subject.convert_to("fur²").quantity).to eq(0.2) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(320) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(320) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(1045440) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(8) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(200000) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(1.99999180720522) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(87119.6515203485) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.00312498750039802) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(19.9999180720522) end end @@ -312,8 +452,36 @@ expect(subject.convert_to("fur²").quantity).to eq(49.4210762934331) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(79073.7220694929) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(79073.7220694929) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(2.58333850001033e+8) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(1976.84305173732) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4.94210762934331e+7) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(494.208738450651) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(2.15277347222222e+7) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.772201228365976) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(4942.08738450651) end end @@ -364,8 +532,36 @@ expect(subject.convert_to("fur²").quantity).to eq(3.18845015814713e-8) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(5.1015202530354e-5) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(5.1015202530354e-5) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(0.166666666666667) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(1.27538006325885e-6) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(0.0318845015814713) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(3.18843709698822e-7) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(0.0138888333333889) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(4.98193344492593e-10) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(3.18843709698822e-6) end end @@ -416,8 +612,36 @@ expect(subject.convert_to("fur²").quantity).to eq(4.59136822773186e-6) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(0.00734618916437098) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.00734618916437098) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(24) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.000183654729109275) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4.59136822773186) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(4.59134941966303e-5) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(1.999992000008) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(7.17398416069334e-8) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.000459134941966303) end end @@ -468,8 +692,36 @@ expect(subject.convert_to("fur²").quantity).to eq(0.0000413223140495868) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(0.0661157024793388) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.0661157024793388) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(216) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.00165289256198347) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(41.3223140495868) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.000413221447769673) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(17.999928000072) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(6.45658574462401e-7) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.00413221447769673) end end @@ -520,8 +772,36 @@ expect(subject.convert_to("fur²").quantity).to eq(128) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(2.048e+5) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(2.048e+5) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(6.690816e+8) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(5120) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(1.28e+8) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(1279.99475661134) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(5.5756576973023e+7) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(1.99999200025473) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(12799.9475661134) end end @@ -572,8 +852,36 @@ expect(subject.convert_to("fur²").quantity).to eq(0.02) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(32) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(32) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(104544) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.8) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(20000) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.199999180720522) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(8711.96515203485) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.000312498750039802) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(1.99999180720522) end end @@ -624,13 +932,41 @@ expect(subject.convert_to("ch²").quantity).to eq(200) end - it "converts to rod²" do - expect(subject.convert_to("rod²").quantity).to eq(3200) + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(3200) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(1.04544e+7) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(80) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(2e+6) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(19.9999180720522) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(8.71196515203485e+5) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.0312498750039802) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(199.999180720522) end end - describe "rod²" do - subject { described_class.new(2, "rod²") } + describe "rd²" do + subject { described_class.new(2, "rd²") } it "converts to m²" do expect(subject.convert_to("m²").quantity).to eq(50.58570528) @@ -679,5 +1015,593 @@ it "converts to fur²" do expect(subject.convert_to("fur²").quantity).to eq(0.00125) end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(6534) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.05) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(1250) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.0124999487950326) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(544.497822002178) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(1.95311718774876e-5) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.124999487950326) + end + end + + describe "bd" do + subject { described_class.new(2, "bd") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(0.01548384) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(0.0001548384) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(1.548384e+26) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(1.548384e-6) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(3.82614018977655e-6) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(1.548384e-8) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(24) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(0.166666666666667) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(0.0185185185185185) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(5.97834404652587e-9) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(3.82614018977655e-5) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(3.82614018977655e-7) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.000612182430364249) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(1.53045607591062e-5) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(0.382614018977655) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(3.82612451638586e-6) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(0.166666000000667) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(5.97832013391112e-9) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(3.82612451638586e-5) + end + end + + describe "ro" do + subject { described_class.new(2, "ro") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(2023.4282112) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(20.234282112) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(2.0234282112e+31) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(0.20234282112) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(0.5) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(0.0020234282112) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(3.136320e+6) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(21780) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(2420) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(0.00078125) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(5) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(0.05) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(80) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(261360) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(50000) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.499997951801304) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(21779.9128800871) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.000781246875099505) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(4.99997951801304) + end + end + + describe "lnk²" do + subject { described_class.new(2, "lnk²") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(0.080937128448) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(0.00080937128448) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(8.0937128448e+26) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(8.0937128448e-6) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(2e-5) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(8.0937128448e-8) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(125.4528) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(0.8712) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(0.0968) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(3.125e-8) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(0.0002) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(2e-6) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.0032) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(10.4544) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(8e-5) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(1.99999180720522e-5) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(0.871196515203485) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(3.12498750039802e-8) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.000199999180720522) + end + end + + describe "ac (US)" do + subject { described_class.new(2, "ac (US)") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(8093.746) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(80.93746) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(8.093746e+31) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(0.8093746) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(2.00000819282834) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(0.008093746) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(1.25453313906628e+7) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(87120.3568796027) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(9680.03965328918) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(0.00312501280129429) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(20.0000819282834) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(0.200000819282834) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(320.001310852535) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(1.04544428255523e+6) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(8.00003277131337) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(200000.819282834) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(87120.0083985236) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.0031250003016411) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(20) + end + end + + describe "ft² (US)" do + subject { described_class.new(2, "ft² (US)") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(0.18580682322655) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(0.0018580682322655) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(1.8580682322655e+27) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(1.8580682322655e-5) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(4.59138659325987e-5) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(1.8580682322655e-7) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(288.001152003456) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(2.000008000024) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(0.222223111113778) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(7.17404155196855e-8) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(0.000459138659325987) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(4.59138659325987e-6) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(0.00734621854921579) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(24.000096000288) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.000183655463730395) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(4.59138659325987) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(4.59136778511581e-5) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(7.17401285671607e-8) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(0.000459136778511581) + end + end + + describe "mi² (US)" do + subject { described_class.new(2, "mi² (US)") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(5.17999694e+6) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(51799.9694) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(5.17999694e+34) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(517.999694) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(1280.00511985745) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(5.17999694) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(8.02901131502263e+9) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(5.57570230209905e+7) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(6.19522478011006e+6) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(2.00000799977726) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(12800.0511985745) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(128.000511985745) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(2.04800819177192e+5) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(6.69084276251886e+8) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(5120.0204794298) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(1.28000511985745e+8) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(1279.99987644782) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(5.57567999931214e+7) + end + + it "converts to ch² (US)" do + expect(subject.convert_to("ch² (US)").quantity).to eq(12799.9987644782) + end + end + + describe "ch² (US)" do + subject { described_class.new(2, "ch² (US)") } + + it "converts to m²" do + expect(subject.convert_to("m²").quantity).to eq(809.3746) + end + + it "converts to a" do + expect(subject.convert_to("a").quantity).to eq(8.093746) + end + + it "converts to b" do + expect(subject.convert_to("b").quantity).to eq(8.093746e+30) + end + + it "converts to ha" do + expect(subject.convert_to("ha").quantity).to eq(0.08093746) + end + + it "converts to ac" do + expect(subject.convert_to("ac").quantity).to eq(0.200000819282834) + end + + it "converts to km²" do + expect(subject.convert_to("km²").quantity).to eq(0.0008093746) + end + + it "converts to in²" do + expect(subject.convert_to("in²").quantity).to eq(1.25453313906628e+6) + end + + it "converts to ft²" do + expect(subject.convert_to("ft²").quantity).to eq(8712.03568796027) + end + + it "converts to yd²" do + expect(subject.convert_to("yd²").quantity).to eq(968.003965328918) + end + + it "converts to mi²" do + expect(subject.convert_to("mi²").quantity).to eq(0.000312501280129429) + end + + it "converts to ch²" do + expect(subject.convert_to("ch²").quantity).to eq(2.00000819282834) + end + + it "converts to fur²" do + expect(subject.convert_to("fur²").quantity).to eq(0.0200000819282834) + end + + it "converts to rd²" do + expect(subject.convert_to("rd²").quantity).to eq(32.0001310852535) + end + + it "converts to bd" do + expect(subject.convert_to("bd").quantity).to eq(1.04544428255523e+5) + end + + it "converts to ro" do + expect(subject.convert_to("ro").quantity).to eq(0.800003277131337) + end + + it "converts to lnk²" do + expect(subject.convert_to("lnk²").quantity).to eq(20000.0819282834) + end + + it "converts to ac (US)" do + expect(subject.convert_to("ac (US)").quantity).to eq(0.2) + end + + it "converts to ft² (US)" do + expect(subject.convert_to("ft² (US)").quantity).to eq(8712.00083985236) + end + + it "converts to mi² (US)" do + expect(subject.convert_to("mi² (US)").quantity).to eq(0.00031250003016411) + end end end diff --git a/spec/unit_measurements/unit_groups/velocity_spec.rb b/spec/unit_measurements/unit_groups/velocity_spec.rb index e9476a4..e0381eb 100644 --- a/spec/unit_measurements/unit_groups/velocity_spec.rb +++ b/spec/unit_measurements/unit_groups/velocity_spec.rb @@ -24,30 +24,50 @@ expect(subject.convert_to("in/s").quantity).to eq(40.5333070866142) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(3.37777559055118) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(2431.99842519685) end it "converts to in/h" do expect(subject.convert_to("in/h").quantity).to eq(1.45919905511811e+5) end + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(3.37777559055118) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(202.666535433071) + end + it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(12159.9921259843) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(2431.99842519685) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(0.000639730225483178) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(202.666535433071) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.0383838135289907) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(2.30302881173944) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(6190.8959711365) end end describe "m/s" do subject { described_class.new(2, "m/s") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(3.88520765463612) + end + it "converts to m/min" do expect(subject.convert_to("m/min").quantity).to eq(120) end @@ -56,38 +76,54 @@ expect(subject.convert_to("m/h").quantity).to eq(7200) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(3.88520765463612) - end - it "converts to in/s" do expect(subject.convert_to("in/s").quantity).to eq(78.740157480315) end + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(4724.4094488189) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(2.83464566929134e+5) + end + it "converts to ft/s" do expect(subject.convert_to("ft/s").quantity).to eq(6.56167979002625) end - it "converts to in/h" do - expect(subject.convert_to("in/h").quantity).to eq(283464.566929134) + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(393.700787401575) end it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(23622.0472440945) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(4724.4094488189) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(0.00124274238447467) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(393.700787401575) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.0745645430684801) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(4.4738725841088) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(12026.4582080577) end end describe "m/min" do subject { described_class.new(2, "m/min") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.064753460910602) + end + it "converts to m/s" do expect(subject.convert_to("m/s").quantity).to eq(0.0333333333333333) end @@ -96,38 +132,54 @@ expect(subject.convert_to("m/h").quantity).to eq(120) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.064753460910602) - end - it "converts to in/s" do expect(subject.convert_to("in/s").quantity).to eq(1.31233595800525) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.109361329833771) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(78.740157480315) end it "converts to in/h" do expect(subject.convert_to("in/h").quantity).to eq(4724.4094488189) end + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.109361329833771) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(6.56167979002625) + end + it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(393.700787401575) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(78.740157480315) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(2.07123730745778e-5) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(6.56167979002625) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.00124274238447467) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.0745645430684801) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(200.440970134295) end end describe "m/h" do subject { described_class.new(2, "m/h") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.00107922434851003) + end + it "converts to m/s" do expect(subject.convert_to("m/s").quantity).to eq(0.000555555555555556) end @@ -136,38 +188,54 @@ expect(subject.convert_to("m/min").quantity).to eq(0.0333333333333333) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.00107922434851003) - end - it "converts to in/s" do expect(subject.convert_to("in/s").quantity).to eq(0.0218722659667542) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.00182268883056285) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(1.31233595800525) end it "converts to in/h" do expect(subject.convert_to("in/h").quantity).to eq(78.740157480315) end + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.00182268883056285) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(0.109361329833771) + end + it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(6.56167979002625) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(1.31233595800525) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(3.4520621790963e-7) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(0.109361329833771) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(2.07123730745778e-5) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.00124274238447467) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(3.34068283557159) end end describe "in/s" do subject { described_class.new(2, "in/s") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.0986842744277575) + end + it "converts to m/s" do expect(subject.convert_to("m/s").quantity).to eq(0.0508) end @@ -180,34 +248,162 @@ expect(subject.convert_to("m/h").quantity).to eq(182.88) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.0986842744277575) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(120) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(7200) end it "converts to ft/s" do expect(subject.convert_to("ft/s").quantity).to eq(0.166666666666667) end - it "converts to in/h" do - expect(subject.convert_to("in/h").quantity).to eq(7200) + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(10) end it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(600) end + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(3.15656565656566e-5) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.00189393939393939) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.113636363636364) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(305.472038484666) + end + end + + describe "in/min" do + subject { described_class.new(2, "in/min") } + + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.00164473790712929) + end + + it "converts to m/s" do + expect(subject.convert_to("m/s").quantity).to eq(0.000846666666666667) + end + + it "converts to m/min" do + expect(subject.convert_to("m/min").quantity).to eq(0.0508) + end + + it "converts to m/h" do + expect(subject.convert_to("m/h").quantity).to eq(3.048) + end + + it "converts to in/s" do + expect(subject.convert_to("in/s").quantity).to eq(0.0333333333333333) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(120) + end + + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.00277777777777778) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(0.166666666666667) + end + + it "converts to ft/h" do + expect(subject.convert_to("ft/h").quantity).to eq(10) + end + + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(5.26094276094276e-7) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(3.15656565656566e-5) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.00189393939393939) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(5.0912006414111) + end + end + + describe "in/h" do + subject { described_class.new(2, "in/h") } + + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.0000274122984521549) + end + + it "converts to m/s" do + expect(subject.convert_to("m/s").quantity).to eq(0.0000141111111111111) + end + + it "converts to m/min" do + expect(subject.convert_to("m/min").quantity).to eq(0.000846666666666667) + end + + it "converts to m/h" do + expect(subject.convert_to("m/h").quantity).to eq(0.0508) + end + + it "converts to in/s" do + expect(subject.convert_to("in/s").quantity).to eq(0.000555555555555556) + end + it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(120) + expect(subject.convert_to("in/min").quantity).to eq(0.0333333333333333) + end + + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.0000462962962962963) end it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(10) + expect(subject.convert_to("ft/min").quantity).to eq(0.00277777777777778) + end + + it "converts to ft/h" do + expect(subject.convert_to("ft/h").quantity).to eq(0.166666666666667) + end + + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(8.7682379349046e-9) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(5.26094276094276e-7) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(3.15656565656566e-5) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(0.0848533440235184) end end describe "ft/s" do subject { described_class.new(2, "ft/s") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(1.18421129313309) + end + it "converts to m/s" do expect(subject.convert_to("m/s").quantity).to eq(0.6096) end @@ -220,74 +416,106 @@ expect(subject.convert_to("m/h").quantity).to eq(2194.56) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(1.18421129313309) - end - it "converts to in/s" do expect(subject.convert_to("in/s").quantity).to eq(24) end + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(1440) + end + it "converts to in/h" do expect(subject.convert_to("in/h").quantity).to eq(86400) end + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(120) + end + it "converts to ft/h" do expect(subject.convert_to("ft/h").quantity).to eq(7200) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(1440) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(0.000378787878787879) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(120) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.0227272727272727) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(1.36363636363636) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(3665.66446181599) end end - describe "in/h" do - subject { described_class.new(2, "in/h") } + describe "ft/min" do + subject { described_class.new(2, "ft/min") } + + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.0197368548855515) + end it "converts to m/s" do - expect(subject.convert_to("m/s").quantity).to eq(0.0000141111111111111) + expect(subject.convert_to("m/s").quantity).to eq(0.01016) end it "converts to m/min" do - expect(subject.convert_to("m/min").quantity).to eq(0.000846666666666667) + expect(subject.convert_to("m/min").quantity).to eq(0.6096) end it "converts to m/h" do - expect(subject.convert_to("m/h").quantity).to eq(0.0508) + expect(subject.convert_to("m/h").quantity).to eq(36.576) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.0000274122984521549) + it "converts to in/s" do + expect(subject.convert_to("in/s").quantity).to eq(0.4) end - it "converts to in/s" do - expect(subject.convert_to("in/s").quantity).to eq(0.000555555555555556) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(24) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(1440) end it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.0000462962962962963) + expect(subject.convert_to("ft/s").quantity).to eq(0.0333333333333333) end it "converts to ft/h" do - expect(subject.convert_to("ft/h").quantity).to eq(0.166666666666667) + expect(subject.convert_to("ft/h").quantity).to eq(120) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(0.0333333333333333) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(6.31313131313131e-6) end - it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(0.00277777777777778) + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.000378787878787879) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.0227272727272727) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(61.0944076969332) end end describe "ft/h" do subject { described_class.new(2, "ft/h") } + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(0.000328947581425858) + end + it "converts to m/s" do expect(subject.convert_to("m/s").quantity).to eq(0.000169333333333333) end @@ -300,108 +528,264 @@ expect(subject.convert_to("m/h").quantity).to eq(0.6096) end - it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.000328947581425858) - end - it "converts to in/s" do expect(subject.convert_to("in/s").quantity).to eq(0.00666666666666667) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.000555555555555556) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(0.4) end it "converts to in/h" do expect(subject.convert_to("in/h").quantity).to eq(24) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(0.4) + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.000555555555555556) end it "converts to ft/min" do expect(subject.convert_to("ft/min").quantity).to eq(0.0333333333333333) end + + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(1.05218855218855e-7) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(6.31313131313131e-6) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.000378787878787879) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(1.01824012828222) + end end - describe "in/min" do - subject { described_class.new(2, "in/min") } + describe "mi/s" do + subject { described_class.new(2, "mi/s") } + + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(6252.63562774271) + end it "converts to m/s" do - expect(subject.convert_to("m/s").quantity).to eq(0.000846666666666667) + expect(subject.convert_to("m/s").quantity).to eq(3218.688) end it "converts to m/min" do - expect(subject.convert_to("m/min").quantity).to eq(0.0508) + expect(subject.convert_to("m/min").quantity).to eq(1.9312128e+5) end it "converts to m/h" do - expect(subject.convert_to("m/h").quantity).to eq(3.048) + expect(subject.convert_to("m/h").quantity).to eq(1.15872768e+7) + end + + it "converts to in/s" do + expect(subject.convert_to("in/s").quantity).to eq(126720) + end + + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(7.6032e+6) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(4.56192e+8) end + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(10560) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(6.336e+5) + end + + it "converts to ft/h" do + expect(subject.convert_to("ft/h").quantity).to eq(3.8016e+7) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(120) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(7200) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(1.93547083583885e+7) + end + end + + describe "mi/min" do + subject { described_class.new(2, "mi/min") } + it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.00164473790712929) + expect(subject.convert_to("Kn").quantity).to eq(104.210593795712) + end + + it "converts to m/s" do + expect(subject.convert_to("m/s").quantity).to eq(53.6448) + end + + it "converts to m/min" do + expect(subject.convert_to("m/min").quantity).to eq(3218.688) + end + + it "converts to m/h" do + expect(subject.convert_to("m/h").quantity).to eq(1.9312128e+5) end it "converts to in/s" do - expect(subject.convert_to("in/s").quantity).to eq(0.0333333333333333) + expect(subject.convert_to("in/s").quantity).to eq(2112) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.00277777777777778) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(1.2672e+5) end it "converts to in/h" do - expect(subject.convert_to("in/h").quantity).to eq(120) + expect(subject.convert_to("in/h").quantity).to eq(7.6032e+6) end - it "converts to ft/h" do - expect(subject.convert_to("ft/h").quantity).to eq(10) + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(176) end it "converts to ft/min" do - expect(subject.convert_to("ft/min").quantity).to eq(0.166666666666667) + expect(subject.convert_to("ft/min").quantity).to eq(10560) + end + + it "converts to ft/h" do + expect(subject.convert_to("ft/h").quantity).to eq(6.336e+5) + end + + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(0.0333333333333333) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(120) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(322578.472639808) end end - describe "ft/min" do - subject { described_class.new(2, "ft/min") } + describe "mi/h" do + subject { described_class.new(2, "mi/h") } + + it "converts to Kn" do + expect(subject.convert_to("Kn").quantity).to eq(1.73684322992853) + end it "converts to m/s" do - expect(subject.convert_to("m/s").quantity).to eq(0.01016) + expect(subject.convert_to("m/s").quantity).to eq(0.89408) end it "converts to m/min" do - expect(subject.convert_to("m/min").quantity).to eq(0.6096) + expect(subject.convert_to("m/min").quantity).to eq(53.6448) end it "converts to m/h" do - expect(subject.convert_to("m/h").quantity).to eq(36.576) + expect(subject.convert_to("m/h").quantity).to eq(3218.688) end + it "converts to in/s" do + expect(subject.convert_to("in/s").quantity).to eq(35.2) + end + + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(2112) + end + + it "converts to in/h" do + expect(subject.convert_to("in/h").quantity).to eq(1.2672e+5) + end + + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(2.93333333333333) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(176) + end + + it "converts to ft/h" do + expect(subject.convert_to("ft/h").quantity).to eq(10560) + end + + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(0.000555555555555556) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(0.0333333333333333) + end + + it "converts to fur/ftn" do + expect(subject.convert_to("fur/ftn").quantity).to eq(5376.30787733013) + end + end + + describe "fur/ftn" do + subject { described_class.new(2, "fur/ftn") } + it "converts to Kn" do - expect(subject.convert_to("Kn").quantity).to eq(0.0197368548855515) + expect(subject.convert_to("Kn").quantity).to eq(0.000646110032965987) + end + + it "converts to m/s" do + expect(subject.convert_to("m/s").quantity).to eq(0.0003326) + end + + it "converts to m/min" do + expect(subject.convert_to("m/min").quantity).to eq(0.019956) + end + + it "converts to m/h" do + expect(subject.convert_to("m/h").quantity).to eq(1.19736) end it "converts to in/s" do - expect(subject.convert_to("in/s").quantity).to eq(0.4) + expect(subject.convert_to("in/s").quantity).to eq(0.0130944881889764) end - it "converts to ft/s" do - expect(subject.convert_to("ft/s").quantity).to eq(0.0333333333333333) + it "converts to in/min" do + expect(subject.convert_to("in/min").quantity).to eq(0.785669291338583) end it "converts to in/h" do - expect(subject.convert_to("in/h").quantity).to eq(1440) + expect(subject.convert_to("in/h").quantity).to eq(47.140157480315) + end + + it "converts to ft/s" do + expect(subject.convert_to("ft/s").quantity).to eq(0.00109120734908137) + end + + it "converts to ft/min" do + expect(subject.convert_to("ft/min").quantity).to eq(0.0654724409448819) end it "converts to ft/h" do - expect(subject.convert_to("ft/h").quantity).to eq(120) + expect(subject.convert_to("ft/h").quantity).to eq(3.92834645669291) end - it "converts to in/min" do - expect(subject.convert_to("in/min").quantity).to eq(24) + it "converts to mi/s" do + expect(subject.convert_to("mi/s").quantity).to eq(2.06668058538137e-7) + end + + it "converts to mi/min" do + expect(subject.convert_to("mi/min").quantity).to eq(1.24000835122882e-5) + end + + it "converts to mi/h" do + expect(subject.convert_to("mi/h").quantity).to eq(0.000744005010737294) end end end diff --git a/units.md b/units.md index 63bfa9c..2359c27 100644 --- a/units.md +++ b/units.md @@ -3,11 +3,13 @@ As there are lots of units bundled with `unit_measurements`, we recommend you to check below list of bundled units before converting your measurements. -**Notes:** -1. Unit names suffixed with `*` support [Decimal SI prefixes](README.md#decimal-si-prefixes). -2. Unit names suffixed with `**` support [Binary SI prefixes](README.md#binary-si-prefixes) -in addition to [Decimal SI prefixes](README.md#decimal-si-prefixes). -3. Primitive unit of the unit group is in _emphasised typeface_. +**Legend** + +| Indicator | Definition | +|:--|:--| +| * | supports [decimal SI prefixes](README.md#decimal-si-prefixes) | +| ** | supports [binary SI prefixes](README.md#binary-si-prefixes) in addition to [decimal SI prefixes](README.md#decimal-si-prefixes) | +| _Italic_ | Primitive unit of the unit group | ## 1. Length or distance @@ -122,20 +124,27 @@ These units are defined in `UnitMeasurements::Area`. | # | Name | Aliases | |:--|:--|:--| | _1_ | _m²_ | _m^2, sq m, square meter, square meters, square metre, square metres_ | -| 2 | km² | km^2, sq km, square kilometer, square kilometers, square kilometre, square kilometres | -| 3 | a | are, ares | -| 4 | b | barn, barns | -| 5 | ha | hectare, hectares | -| 6 | ac | acre, acres | -| 7 | in² | in^2, sq in, square inch, square inches | -| 8 | ft² | ft^2, sq ft, square foot, square feet | -| 9 | yd² | yd^2, sq yd, square yard, square yards | -| 10 | mi² | mi^2, sq mi, square mile, square miles | -| 11 | ch² | ch^2, sq ch, square chain, square chains | -| 12 | fur² | fur^2, sq fur, square furlong, square furlongs | -| 13 | rod² | rod^2, sq rod, square rod, square rods | - -## 9. Volume & Capacity +| 2 | a | are, ares | +| 3 | b | barn, barns | +| 4 | ha | hectare, hectares | +| 5 | ac | acre, acres | +| 6 | bd | board, boards | +| 7 | ro | rood | +| 8 | km² | km^2, sq km, square kilometer, square kilometers, square kilometre, square kilometres | +| 9 | in² | in^2, sq in, square inch, square inches | +| 10 | ft² | ft^2, sq ft, square foot, square feet | +| 11 | yd² | yd^2, sq yd, square yard, square yards | +| 12 | mi² | mi^2, sq mi, square mile, square miles | +| 13 | ch² | ch^2, sq ch, square chain, square chains | +| 14 | fur² | fur^2, sq fur, square furlong, square furlongs | +| 15 | rd² | rd^2, sq rd, square rod, square rods | +| 16 | lnk² | link^2, sq lnk, square link, square links | +| 17 | ac (US) | acre (US), acres (US) | +| 18 | ft² (US) | ft^2 (US), sq ft (US), square foot (US), square feet (US) | +| 19 | mi² (US) | mi^2 (US), sq mi (US), square mile (US), square miles (US) | +| 20 | ch² (US) | ch^2 (US), sq ch (US), square chain (US), square chains (US) | + +## 9. Volume & capacity These units are defined in `UnitMeasurements::Volume`. @@ -243,16 +252,20 @@ These units are defined in `UnitMeasurements::Velocity`. | # | Name | Aliases | |:--|:--|:--| -| _1_ | _m/s_ | _m·s⁻¹, meter per second, meters per second, metre per second, metres per second_ | -| 2 | m/min | m·min⁻¹, meter per minute, meters per minute, metre per minute, metres per minute | -| 3 | m/h | m·h⁻¹, meter per hour, meters per hour, metre per hour, metres per hour | -| 4 | Kn | kt, knot, knots | +| 1 | Kn | kt, knot, knots | +| _2_ | _m/s_ | _m·s⁻¹, meter per second, meters per second, metre per second, metres per second_ | +| 3 | m/min | m·min⁻¹, meter per minute, meters per minute, metre per minute, metres per minute | +| 4 | m/h | m·h⁻¹, meter per hour, meters per hour, metre per hour, metres per hour | | 5 | in/s | in·s⁻¹, ips, inch per second, inches per second | | 6 | in/min | in·min⁻¹, ipm, inch per minute, inches per minute | | 7 | in/h | in·h⁻¹, iph, inch per hour, inches per hour | | 8 | ft/s | ft·s⁻¹, fps, foot per second, feet per second | | 9 | ft/min | ft·min⁻¹, fpm, foot per minute, feet per minute | -| 10 | ft/h | ft·h⁻¹, fps, foot per hour, feet per hour | +| 10 | ft/h | ft·h⁻¹, fph, foot per hour, feet per hour | +| 11 | mi/s | mi·s⁻¹, mps, mile per second, miles per second | +| 12 | mi/min | mi·min⁻¹, mpm, mile per minute, miles per minute | +| 13 | mi/h | mi·h⁻¹, mph, mile per hour, miles per hour | +| 14 | fur/ftn | fur·ftn⁻¹, furlong per fortnight, furlongs per fortnight | ## 17. Acceleration @@ -260,10 +273,18 @@ These units are defined in `UnitMeasurements::Acceleration`. | # | Name | Aliases | |:--|:--|:--| -| _1_ | _m/s²_ | _m/s^2, m·s⁻², meter per second squared, meters per second squared, metre per second squared, metres per second squared_ | -| 2 | in/s² | in/s^2, in·s⁻², ips², inch per second squared, inches per second squared | -| 3 | ft/s² | ft/s^2, ft·s⁻², fps², foot per second squared, feet per second squared | -| 4 | Kn/s | knot per second, knots per second | +| 1 | Gal | gal, galileo | +| _2_ | _m/s²_ | _m/s^2, m·s⁻², meter per second squared, meters per second squared, metre per second squared, metres per second squared_ | +| 3 | in/s² | in/s^2, in·s⁻², ips², inch per second squared, inches per second squared | +| 4 | ipm/s | in/(min⋅s), inch per minute per second, inches per minute per second | +| 5 | iph/s | in/(h⋅s), inch per hour per second, inches per hour per second | +| 5 | ft/s² | ft/s^2, ft·s⁻², fps², foot per second squared, feet per second squared | +| 6 | fpm/s | ft/(min⋅s), foot per minute per second, feet per minute per second | +| 7 | fph/s | ft/(h⋅s), foot per hour per second, feet per hour per second | +| 8 | mi/s² | mi/s^2, mi·s⁻², mps², mile per second squared, miles per second squared | +| 9 | mpm/s | mi/(min⋅s), mile per minute per second, miles per minute per second | +| 10 | mph/s | mi/(h⋅s), mile per hour per second, miles per hour per second | +| 11 | Kn/s | knot per second, knots per second | ## 18. Angular velocity or rotational speed