-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from shivam091/5.18.0
5.18.0
- Loading branch information
Showing
8 changed files
with
397 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
UnitMeasurements::MassFlowRate = UnitMeasurements.build do | ||
primitive "kg/s" | ||
|
||
system :metric do | ||
unit "kg/s", aliases: ["kilogramme per second", "kilogrammes per second", "kilogram per second", "kilograms per second"] | ||
unit "kg/min", value: "1/60 kg/s", aliases: ["kilogramme per minute", "kilogrammes per minute", "kilogram per minute", "kilograms per minute"] | ||
unit "kg/h", value: "1/60 kg/min", aliases: ["kilogramme per hour", "kilogrammes per hour", "kilogram per hour", "kilograms per hour"] | ||
|
||
unit "g/s", value: "1/1000 kg/s", aliases: ["gramme per second", "grammes per second", "gram per second", "grams per second"] | ||
unit "g/min", value: "1/60 g/s", aliases: ["gramme per minute", "grammes per minute", "gram per minute", "grams per minute"] | ||
unit "g/h", value: "1/60 g/min", aliases: ["gramme per hour", "grammes per hour", "gram per hour", "grams per hour"] | ||
|
||
unit "t/s", value: "1000 kg/s", aliases: ["tonne per second", "tonnes per second", "metric tonne per second", "metric tonnes per second"] | ||
unit "t/min", value: "1/60 t/s", aliases: ["tonne per minute", "tonnes per minute", "metric tonne per minute", "metric tonnes per minute"] | ||
unit "t/h", value: "1/60 t/min", aliases: ["tonne per hour", "tonnes per hour", "metric tonne per hour", "metric tonnes per hour"] | ||
end | ||
|
||
system :us_customary do | ||
unit "lb/s", value: "0.45359237 kg/s", aliases: ["pound per second", "pounds per second"] | ||
unit "lb/min", value: "1/60 lb/s", aliases: ["pound per minute", "pounds per minute"] | ||
unit "lb/h", value: "1/60 lb/min", aliases: ["pound per hour", "pounds per hour"] | ||
|
||
unit "tn/s", value: "2000 lb/s", aliases: ["ton per second", "tons per second", "short ton per second", "short tons per second"] | ||
unit "tn/min", value: "1/60 tn/s", aliases: ["ton per minute", "tons per minute", "short ton per minute", "short tons per minute"] | ||
unit "tn/h", value: "1/60 tn/min", aliases: ["ton per hour", "tons per hour", "short ton per hour", "short tons per hour"] | ||
|
||
unit "slug/s", value: "14.5939 kg/s", aliases: ["slug per second", "slugs per second"] | ||
unit "slug/min", value: "1/60 slug/s", aliases: ["slug per minute", "slugs per minute"] | ||
unit "slug/h", value: "1/60 slug/min", aliases: ["slug per hour", "slugs per hour"] | ||
end | ||
|
||
system :imperial do | ||
unit "oz/s", value: "1/16 lb/s", aliases: ["ounce per second", "ounces per second"] | ||
unit "oz/min", value: "1/60 oz/s", aliases: ["ounce per minute", "ounces per minute"] | ||
unit "oz/h", value: "1/60 oz/min", aliases: ["ounce per hour", "ounces per hour"] | ||
|
||
unit "gr/s", value: "1/7000 lb/s", aliases: ["grain per second", "grains per second"] | ||
unit "gr/min", value: "1/60 gr/s", aliases: ["grain per minute", "grains per minute"] | ||
unit "gr/h", value: "1/60 gr/min", aliases: ["grain per hour", "grains per hour"] | ||
|
||
unit "LT/s", value: "2240 lb/s", aliases: ["long ton per second", "long tons per second"] | ||
unit "LT/min", value: "1/60 LT/s", aliases: ["long ton per minute", "long tons per minute"] | ||
unit "LT/h", value: "1/60 LT/min", aliases: ["long ton per hour", "long tons per hour"] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
UnitMeasurements::VolumetricFlowRate = UnitMeasurements.build do | ||
primitive "m³/s" | ||
|
||
system :metric do | ||
unit "m³/s", aliases: ["m^3/s", "cubic metre per second", "cubic metres per second", "cubic meter per second", "cubic meters per second"] | ||
unit "m³/min", value: "1/60 m³/s", aliases: ["m^3/min", "cubic metre per minute", "cubic metres per minute", "cubic meter per minute", "cubic meters per minute"] | ||
unit "m³/h", value: "1/60 m³/min", aliases: ["m^3/h", "cubic metre per hour", "cubic metres per hour", "cubic meter per hour", "cubic meters per hour"] | ||
|
||
unit "l/s", value: "1/1000 m³/s", aliases: ["L/s", "litre per second", "litres per second", "liter per second", "liters per second"] | ||
unit "l/min", value: "1/60 l/s", aliases: ["L/min", "litre per minute", "litres per minute", "liter per minute", "liters per minute"] | ||
unit "l/h", value: "1/60 l/min", aliases: ["L/h", "litre per hour", "litres per hour", "liter per hour", "liters per hour"] | ||
end | ||
|
||
system :imperial do | ||
unit "ft³/s", value: "0.028316846592 m³/s", aliases: ["ft^3/s", "cubic foot per second", "cubic feet per second"] | ||
unit "ft³/min", value: "1/60 ft³/s", aliases: ["ft^3/min", "cubic foot per minute", "cubic feet per minute"] | ||
unit "ft³/h", value: "1/60 ft³/min", aliases: ["ft^3/h", "cubic foot per hour", "cubic feet per hour"] | ||
|
||
unit "in³/s", value: "1.6387064e-5 m³/s", aliases: ["in^3/s", "cubic inch per second", "cubic inches per second"] | ||
unit "in³/min", value: "1/60 in³/s", aliases: ["in^3/min", "cubic inch per minute", "cubic inches per minute"] | ||
unit "in³/h", value: "1/60 in³/min", aliases: ["in^3/h", "cubic inch per hour", "cubic inches per hour"] | ||
|
||
unit "yd³/s", value: "0.764554857984 m³/s", aliases: ["yd^3/s", "cubic yard per second", "cubic yards per second"] | ||
unit "yd³/min", value: "1/60 yd³/s", aliases: ["yd^3/min", "cubic yard per minute", "cubic yards per minute"] | ||
unit "yd³/h", value: "1/60 yd³/min", aliases: ["yd^3/h", "cubic yard per hour", "cubic yards per hour"] | ||
|
||
unit "gal/s", value: "0.00454609 m³/s", aliases: ["gallon per second", "gallons per second"] | ||
unit "gal/min", value: "1/60 gal/s", aliases: ["gallon per minute", "gallons per minute"] | ||
unit "gal/h", value: "1/60 gal/min", aliases: ["gallon per hour", "gallons per hour"] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
spec/unit_measurements/unit_groups/mass_flow_rate_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
# spec/unit_measurements/unit_groups/mass_flow_rate_spec.rb | ||
|
||
RSpec.describe UnitMeasurements::MassFlowRate do | ||
describe "kg/s" do | ||
subject { described_class.new(5, "kg/s") } | ||
|
||
it "converts to kg/min" do | ||
expect(subject.convert_to("kg/min").quantity).to eq(300) | ||
end | ||
|
||
it "converts to kg/h" do | ||
expect(subject.convert_to("kg/h").quantity).to eq(18000) | ||
end | ||
|
||
it "converts to g/s" do | ||
expect(subject.convert_to("g/s").quantity).to eq(5000) | ||
end | ||
|
||
it "converts to g/min" do | ||
expect(subject.convert_to("g/min").quantity).to eq(300000) | ||
end | ||
|
||
it "converts to g/h" do | ||
expect(subject.convert_to("g/h").quantity).to eq(18000000) | ||
end | ||
|
||
it "converts to t/s" do | ||
expect(subject.convert_to("t/s").quantity).to eq(0.005) | ||
end | ||
|
||
it "converts to t/min" do | ||
expect(subject.convert_to("t/min").quantity).to eq(0.3) | ||
end | ||
|
||
it "converts to t/h" do | ||
expect(subject.convert_to("t/h").quantity).to eq(18) | ||
end | ||
|
||
it "converts to lb/s" do | ||
expect(subject.convert_to("lb/s").quantity).to eq(11.0231131092439) | ||
end | ||
|
||
it "converts to lb/min" do | ||
expect(subject.convert_to("lb/min").quantity).to eq(661.386786554633) | ||
end | ||
|
||
it "converts to lb/h" do | ||
expect(subject.convert_to("lb/h").quantity).to eq(39683.207193278) | ||
end | ||
|
||
it "converts to tn/s" do | ||
expect(subject.convert_to("tn/s").quantity).to eq(0.00551155655462194) | ||
end | ||
|
||
it "converts to tn/min" do | ||
expect(subject.convert_to("tn/min").quantity).to eq(0.330693393277316) | ||
end | ||
|
||
it "converts to tn/h" do | ||
expect(subject.convert_to("tn/h").quantity).to eq(19.841603596639) | ||
end | ||
|
||
it "converts to slug/s" do | ||
expect(subject.convert_to("slug/s").quantity).to eq(0.342608898238305) | ||
end | ||
|
||
it "converts to slug/min" do | ||
expect(subject.convert_to("slug/min").quantity).to eq(20.5565338942983) | ||
end | ||
|
||
it "converts to slug/h" do | ||
expect(subject.convert_to("slug/h").quantity).to eq(1233.3920336579) | ||
end | ||
|
||
it "converts to oz/s" do | ||
expect(subject.convert_to("oz/s").quantity).to eq(176.369809747902) | ||
end | ||
|
||
it "converts to oz/min" do | ||
expect(subject.convert_to("oz/min").quantity).to eq(10582.1885848741) | ||
end | ||
|
||
it "converts to oz/h" do | ||
expect(subject.convert_to("oz/h").quantity).to eq(634931.315092447) | ||
end | ||
|
||
it "converts to gr/s" do | ||
expect(subject.convert_to("gr/s").quantity).to eq(77161.7917647071) | ||
end | ||
|
||
it "converts to gr/min" do | ||
expect(subject.convert_to("gr/min").quantity).to eq(4.62970750588243e+6) | ||
end | ||
|
||
it "converts to gr/h" do | ||
expect(subject.convert_to("gr/h").quantity).to eq(2.77782450352946e+8) | ||
end | ||
|
||
it "converts to LT/s" do | ||
expect(subject.convert_to("LT/s").quantity).to eq(0.0049210326380553) | ||
end | ||
|
||
it "converts to LT/min" do | ||
expect(subject.convert_to("LT/min").quantity).to eq(0.295261958283318) | ||
end | ||
|
||
it "converts to LT/h" do | ||
expect(subject.convert_to("LT/h").quantity).to eq(17.7157174969991) | ||
end | ||
end | ||
end |
79 changes: 79 additions & 0 deletions
79
spec/unit_measurements/unit_groups/volumetric_flow_rate_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# -*- encoding: utf-8 -*- | ||
# -*- frozen_string_literal: true -*- | ||
# -*- warn_indent: true -*- | ||
|
||
# spec/unit_measurements/unit_groups/volumetric_flow_rate_spec.rb | ||
|
||
RSpec.describe UnitMeasurements::VolumetricFlowRate do | ||
describe "m³/s" do | ||
subject { described_class.new(5, "m³/s") } | ||
|
||
it "converts to m³/min" do | ||
expect(subject.convert_to("m³/min").quantity).to eq(300) | ||
end | ||
|
||
it "converts to m³/h" do | ||
expect(subject.convert_to("m³/h").quantity).to eq(18000) | ||
end | ||
|
||
it "converts to l/s" do | ||
expect(subject.convert_to("l/s").quantity).to eq(5000) | ||
end | ||
|
||
it "converts to l/min" do | ||
expect(subject.convert_to("l/min").quantity).to eq(3e+5) | ||
end | ||
|
||
it "converts to l/h" do | ||
expect(subject.convert_to("l/h").quantity).to eq(1.8e+7) | ||
end | ||
|
||
it "converts to ft³/s" do | ||
expect(subject.convert_to("ft³/s").quantity).to eq(176.573333607443) | ||
end | ||
|
||
it "converts to ft³/min" do | ||
expect(subject.convert_to("ft³/min").quantity).to eq(10594.4000164466) | ||
end | ||
|
||
it "converts to ft³/h" do | ||
expect(subject.convert_to("ft³/h").quantity).to eq(635664.000986795) | ||
end | ||
|
||
it "converts to in³/s" do | ||
expect(subject.convert_to("in³/s").quantity).to eq(305118.720473661) | ||
end | ||
|
||
it "converts to in³/min" do | ||
expect(subject.convert_to("in³/min").quantity).to eq(1.83071232284197e+7) | ||
end | ||
|
||
it "converts to in³/h" do | ||
expect(subject.convert_to("in³/h").quantity).to eq(1.09842739370518e+9) | ||
end | ||
|
||
it "converts to yd³/s" do | ||
expect(subject.convert_to("yd³/s").quantity).to eq(6.53975309657196) | ||
end | ||
|
||
it "converts to yd³/min" do | ||
expect(subject.convert_to("yd³/min").quantity).to eq(392.385185794318) | ||
end | ||
|
||
it "converts to yd³/h" do | ||
expect(subject.convert_to("yd³/h").quantity).to eq(23543.1111476591) | ||
end | ||
|
||
it "converts to gal/s" do | ||
expect(subject.convert_to("gal/s").quantity).to eq(1099.84624149544) | ||
end | ||
|
||
it "converts to gal/min" do | ||
expect(subject.convert_to("gal/min").quantity).to eq(65990.7744897263) | ||
end | ||
|
||
it "converts to gal/h" do | ||
expect(subject.convert_to("gal/h").quantity).to eq(3.95944646938358e+6) | ||
end | ||
end | ||
end |
Oops, something went wrong.