farski-systeme 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 2
3
- :patch: 0
3
+ :patch: 1
4
4
  :major: 0
@@ -23,16 +23,16 @@ module Systeme
23
23
  IMPERIAL_MEASURES['length'][:units] << { :unit => "fathom", :factor => 6 }
24
24
  IMPERIAL_MEASURES['length'][:units] << { :unit => "cable", :factor => 608 }
25
25
  IMPERIAL_MEASURES['length'][:units] << { :unit => "nautical_mile", :factor => 6080, :aliases => ["NM", "nmi", "M"] }
26
- IMPERIAL_MEASURES['length'][:units] << { :unit => "link", :factor => (66/100), :aliases => ["lnk"] }
27
- IMPERIAL_MEASURES['length'][:units] << { :unit => "rod", :factor => (66/4), :aliases => ["perch", "perches", "pole", "lug"] }
26
+ IMPERIAL_MEASURES['length'][:units] << { :unit => "link", :factor => (66.0/100), :aliases => ["lnk"] }
27
+ IMPERIAL_MEASURES['length'][:units] << { :unit => "rod", :factor => (66.0/4), :aliases => ["perch", "perches", "pole", "lug"] }
28
28
  IMPERIAL_MEASURES['length'][:units] << { :unit => "chain", :factor => 66 }
29
29
 
30
30
  IMPERIAL_MEASURES['weight'] = Hash.new
31
31
  IMPERIAL_MEASURES['weight'][:si] = 0.45359237
32
32
  IMPERIAL_MEASURES['weight'][:units] = Array.new
33
- IMPERIAL_MEASURES['weight'][:units] << { :unit => "grain", :factor => (1/7000) }
34
- IMPERIAL_MEASURES['weight'][:units] << { :unit => "drachm", :factor => (1/256) }
35
- IMPERIAL_MEASURES['weight'][:units] << { :unit => "ounce", :factor => (1/16), :aliases => ["oz"] }
33
+ IMPERIAL_MEASURES['weight'][:units] << { :unit => "grain", :factor => (1.0/7000) }
34
+ IMPERIAL_MEASURES['weight'][:units] << { :unit => "drachm", :factor => (1.0/256) }
35
+ IMPERIAL_MEASURES['weight'][:units] << { :unit => "ounce", :factor => (1.0/16), :aliases => ["oz"] }
36
36
  IMPERIAL_MEASURES['weight'][:units] << { :unit => "pound", :factor => 1, :aliases => ["lb", "lbm", "lbs"] }
37
37
  IMPERIAL_MEASURES['weight'][:units] << { :unit => "stone", :factor => 14, :aliases => ["st"] }
38
38
  IMPERIAL_MEASURES['weight'][:units] << { :unit => "quarter", :factor => 28 }
@@ -1,24 +1,16 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
3
  class ImperialTest < Test::Unit::TestCase
4
- should "maintain base unit value through declaration" do
5
- assert_equal 1, 1
6
- # assert_equal 1, 1.ft
7
- # assert_equal 1, 1.lb
4
+ should "express imperial unit in metric base unit" do
5
+ assert_in_delta 0.9144, 1.yard, 0.0001
8
6
  end
9
- #
10
- # should "express non-base unit value in the base unit" do
11
- # assert_equal 3, 1.yd
12
- # assert_equal 14, 1.stone
13
- # end
14
7
 
15
- # should "convert value from base unit to any other unit" do
16
- # assert_equal 1000, 1.kg.to_g
17
- # assert_equal 100, 1.m.to_cm
18
- # end
19
- #
20
- # should "convert value between arbitrary units" do
21
- # assert_equal 1, 1000.mg.to_g
22
- # assert_equal 10, 1.cm.to_mm
23
- # end
8
+ should "express non-base unit value in the base unit" do
9
+ assert_equal 3.feet, 1.yard
10
+ assert_equal 14.pounds, 1.stone
11
+ end
12
+
13
+ should "convert value from base unit to any other unit" do
14
+ assert_equal 16, 1.pound.in_ounces
15
+ end
24
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: farski-systeme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Kalafarski