ruby-units 1.3.2 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG.txt +25 -7
  2. data/LICENSE.txt +1 -1
  3. data/README.md +68 -55
  4. data/RakeFile +27 -18
  5. data/TODO +2 -1
  6. data/VERSION +1 -1
  7. data/lib/ruby-units.rb +2 -2
  8. data/lib/ruby_units.rb +2 -2
  9. data/lib/ruby_units/array.rb +4 -2
  10. data/lib/ruby_units/date.rb +17 -4
  11. data/lib/ruby_units/definition.rb +100 -0
  12. data/lib/ruby_units/fixnum.rb +6 -4
  13. data/lib/ruby_units/math.rb +32 -2
  14. data/lib/ruby_units/numeric.rb +2 -1
  15. data/lib/ruby_units/object.rb +8 -1
  16. data/lib/ruby_units/string.rb +10 -109
  17. data/lib/ruby_units/string/extra.rb +45 -11
  18. data/lib/ruby_units/time.rb +11 -2
  19. data/lib/ruby_units/unit.rb +722 -434
  20. data/lib/ruby_units/unit_definitions.rb +3 -252
  21. data/lib/ruby_units/unit_definitions/base.rb +103 -0
  22. data/lib/ruby_units/unit_definitions/prefix.rb +40 -0
  23. data/lib/ruby_units/unit_definitions/standard.rb +705 -0
  24. data/lib/ruby_units/version.rb +1 -0
  25. data/ruby-units.gemspec +15 -20
  26. metadata +46 -35
  27. data/Gemfile +0 -12
  28. data/Manifest.txt +0 -19
  29. data/autotest/discover.rb +0 -1
  30. data/spec/ruby-units/array_spec.rb +0 -14
  31. data/spec/ruby-units/complex_spec.rb +0 -37
  32. data/spec/ruby-units/date_spec.rb +0 -38
  33. data/spec/ruby-units/math_spec.rb +0 -63
  34. data/spec/ruby-units/numeric_spec.rb +0 -12
  35. data/spec/ruby-units/object_spec.rb +0 -7
  36. data/spec/ruby-units/string/extra_spec.rb +0 -45
  37. data/spec/ruby-units/string_spec.rb +0 -20
  38. data/spec/ruby-units/time_spec.rb +0 -28
  39. data/spec/ruby-units/unit_spec.rb +0 -965
  40. data/spec/spec_helper.rb +0 -5
  41. data/test/test_cache.rb +0 -26
  42. data/test/test_ruby-units.rb +0 -976
@@ -1,4 +1,5 @@
1
1
  class Unit < Numeric
2
+ # Pull the version number from the VERSION file
2
3
  module Version
3
4
  STRING = File.read(File.dirname(__FILE__) + "/../../VERSION")
4
5
  end
data/ruby-units.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-units"
8
- s.version = "1.3.2"
8
+ s.version = "1.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kevin Olbrich, Ph.D."]
12
- s.date = "2011-11-21"
12
+ s.date = "2012-01-02"
13
13
  s.description = "Provides classes and methods to perform unit math and conversions"
14
14
  s.email = ["kevin.olbrich+ruby_units@gmail.com"]
15
15
  s.extra_rdoc_files = [
@@ -19,19 +19,17 @@ Gem::Specification.new do |s|
19
19
  ]
20
20
  s.files = [
21
21
  "CHANGELOG.txt",
22
- "Gemfile",
23
22
  "LICENSE.txt",
24
- "Manifest.txt",
25
23
  "README.md",
26
24
  "RakeFile",
27
25
  "TODO",
28
26
  "VERSION",
29
- "autotest/discover.rb",
30
27
  "lib/ruby-units.rb",
31
28
  "lib/ruby_units.rb",
32
29
  "lib/ruby_units/array.rb",
33
30
  "lib/ruby_units/cache.rb",
34
31
  "lib/ruby_units/date.rb",
32
+ "lib/ruby_units/definition.rb",
35
33
  "lib/ruby_units/fixnum.rb",
36
34
  "lib/ruby_units/math.rb",
37
35
  "lib/ruby_units/numeric.rb",
@@ -41,24 +39,15 @@ Gem::Specification.new do |s|
41
39
  "lib/ruby_units/time.rb",
42
40
  "lib/ruby_units/unit.rb",
43
41
  "lib/ruby_units/unit_definitions.rb",
42
+ "lib/ruby_units/unit_definitions/base.rb",
43
+ "lib/ruby_units/unit_definitions/prefix.rb",
44
+ "lib/ruby_units/unit_definitions/standard.rb",
44
45
  "lib/ruby_units/version.rb",
45
- "ruby-units.gemspec",
46
- "spec/ruby-units/array_spec.rb",
47
- "spec/ruby-units/complex_spec.rb",
48
- "spec/ruby-units/date_spec.rb",
49
- "spec/ruby-units/math_spec.rb",
50
- "spec/ruby-units/numeric_spec.rb",
51
- "spec/ruby-units/object_spec.rb",
52
- "spec/ruby-units/string/extra_spec.rb",
53
- "spec/ruby-units/string_spec.rb",
54
- "spec/ruby-units/time_spec.rb",
55
- "spec/ruby-units/unit_spec.rb",
56
- "spec/spec_helper.rb",
57
- "test/test_cache.rb",
58
- "test/test_ruby-units.rb"
46
+ "ruby-units.gemspec"
59
47
  ]
60
48
  s.homepage = "https://github.com/olbrich/ruby-units"
61
- s.post_install_message = "====================\nDeprecation Warning\n====================\n\nSeveral convenience methods that ruby-units added to the string class have\nbeen deprecated in this release. These methods include String#to, String#from, String#ago, String#before and others.\nIf your code relies on these functions, they can be added back by adding this line to your code.\n\nrequire 'ruby-units/string/extras'\n# note that these methods do not play well with Rails, which is one of the reasons they are being removed.\n\nThe extra functions mostly work the same, but will no longer properly handle cases when they are called with strings..\n\n'min'.from(\"4-1-2011\") # => Exception\n\nPass in a Date, Time, or DateTime object to get the expected result.\n\nThey will probably go away completely in an upcoming release, so it would be a good idea to refactor your code\nto avoid using them. They will also throw deprecation warnings when they are used.\n"
49
+ s.licenses = ["MIT"]
50
+ s.post_install_message = "====================\nDeprecation Warning\n====================\n\nSeveral convenience methods that ruby-units added to the string class have\nbeen deprecated in this release. These methods include String#to, String#from, String#ago, String#before and others.\nIf your code relies on these functions, they can be added back by adding this line to your code.\n\nrequire 'ruby-units/string/extras'\n# note that these methods do not play well with Rails, which is one of the reasons they are being removed.\n\nThe extra functions mostly work the same, but will no longer properly handle cases when they are called with strings..\n\n'min'.from(\"4-1-2011\") # => Exception\n\nPass in a Date, Time, or DateTime object to get the expected result.\n\nThey will go away completely in the next release, so it would be a good idea to refactor your code\nto avoid using them. They will also throw deprecation warnings when they are used.\n"
62
51
  s.require_paths = ["lib"]
63
52
  s.rubygems_version = "1.8.10"
64
53
  s.summary = "A class that performs unit conversions and unit math"
@@ -69,6 +58,8 @@ Gem::Specification.new do |s|
69
58
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
70
59
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
71
60
  s.add_development_dependency(%q<rcov>, [">= 0"])
61
+ s.add_development_dependency(%q<simplecov>, [">= 0"])
62
+ s.add_development_dependency(%q<simplecov-html>, [">= 0"])
72
63
  s.add_development_dependency(%q<jeweler>, [">= 0"])
73
64
  s.add_development_dependency(%q<rspec>, ["~> 2.5"])
74
65
  s.add_development_dependency(%q<autotest>, [">= 0"])
@@ -77,6 +68,8 @@ Gem::Specification.new do |s|
77
68
  else
78
69
  s.add_dependency(%q<bundler>, ["~> 1.0"])
79
70
  s.add_dependency(%q<rcov>, [">= 0"])
71
+ s.add_dependency(%q<simplecov>, [">= 0"])
72
+ s.add_dependency(%q<simplecov-html>, [">= 0"])
80
73
  s.add_dependency(%q<jeweler>, [">= 0"])
81
74
  s.add_dependency(%q<rspec>, ["~> 2.5"])
82
75
  s.add_dependency(%q<autotest>, [">= 0"])
@@ -86,6 +79,8 @@ Gem::Specification.new do |s|
86
79
  else
87
80
  s.add_dependency(%q<bundler>, ["~> 1.0"])
88
81
  s.add_dependency(%q<rcov>, [">= 0"])
82
+ s.add_dependency(%q<simplecov>, [">= 0"])
83
+ s.add_dependency(%q<simplecov-html>, [">= 0"])
89
84
  s.add_dependency(%q<jeweler>, [">= 0"])
90
85
  s.add_dependency(%q<rspec>, ["~> 2.5"])
91
86
  s.add_dependency(%q<autotest>, [">= 0"])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-units
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-21 00:00:00.000000000Z
12
+ date: 2012-01-02 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &2153419120 !ruby/object:Gem::Requirement
16
+ requirement: &2157320760 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *2153419120
24
+ version_requirements: *2157320760
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rcov
27
- requirement: &2153418640 !ruby/object:Gem::Requirement
27
+ requirement: &2157320240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,32 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *2153418640
35
+ version_requirements: *2157320240
36
+ - !ruby/object:Gem::Dependency
37
+ name: simplecov
38
+ requirement: &2157319660 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2157319660
47
+ - !ruby/object:Gem::Dependency
48
+ name: simplecov-html
49
+ requirement: &2157319100 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2157319100
36
58
  - !ruby/object:Gem::Dependency
37
59
  name: jeweler
38
- requirement: &2153418060 !ruby/object:Gem::Requirement
60
+ requirement: &2157318340 !ruby/object:Gem::Requirement
39
61
  none: false
40
62
  requirements:
41
63
  - - ! '>='
@@ -43,10 +65,10 @@ dependencies:
43
65
  version: '0'
44
66
  type: :development
45
67
  prerelease: false
46
- version_requirements: *2153418060
68
+ version_requirements: *2157318340
47
69
  - !ruby/object:Gem::Dependency
48
70
  name: rspec
49
- requirement: &2153417460 !ruby/object:Gem::Requirement
71
+ requirement: &2157317580 !ruby/object:Gem::Requirement
50
72
  none: false
51
73
  requirements:
52
74
  - - ~>
@@ -54,10 +76,10 @@ dependencies:
54
76
  version: '2.5'
55
77
  type: :development
56
78
  prerelease: false
57
- version_requirements: *2153417460
79
+ version_requirements: *2157317580
58
80
  - !ruby/object:Gem::Dependency
59
81
  name: autotest
60
- requirement: &2153416880 !ruby/object:Gem::Requirement
82
+ requirement: &2157316680 !ruby/object:Gem::Requirement
61
83
  none: false
62
84
  requirements:
63
85
  - - ! '>='
@@ -65,10 +87,10 @@ dependencies:
65
87
  version: '0'
66
88
  type: :development
67
89
  prerelease: false
68
- version_requirements: *2153416880
90
+ version_requirements: *2157316680
69
91
  - !ruby/object:Gem::Dependency
70
92
  name: autotest-growl
71
- requirement: &2153416340 !ruby/object:Gem::Requirement
93
+ requirement: &2157316020 !ruby/object:Gem::Requirement
72
94
  none: false
73
95
  requirements:
74
96
  - - ! '>='
@@ -76,10 +98,10 @@ dependencies:
76
98
  version: '0'
77
99
  type: :development
78
100
  prerelease: false
79
- version_requirements: *2153416340
101
+ version_requirements: *2157316020
80
102
  - !ruby/object:Gem::Dependency
81
103
  name: autotest-fsevent
82
- requirement: &2153415780 !ruby/object:Gem::Requirement
104
+ requirement: &2157315280 !ruby/object:Gem::Requirement
83
105
  none: false
84
106
  requirements:
85
107
  - - ! '>='
@@ -87,7 +109,7 @@ dependencies:
87
109
  version: '0'
88
110
  type: :development
89
111
  prerelease: false
90
- version_requirements: *2153415780
112
+ version_requirements: *2157315280
91
113
  description: Provides classes and methods to perform unit math and conversions
92
114
  email:
93
115
  - kevin.olbrich+ruby_units@gmail.com
@@ -99,19 +121,17 @@ extra_rdoc_files:
99
121
  - TODO
100
122
  files:
101
123
  - CHANGELOG.txt
102
- - Gemfile
103
124
  - LICENSE.txt
104
- - Manifest.txt
105
125
  - README.md
106
126
  - RakeFile
107
127
  - TODO
108
128
  - VERSION
109
- - autotest/discover.rb
110
129
  - lib/ruby-units.rb
111
130
  - lib/ruby_units.rb
112
131
  - lib/ruby_units/array.rb
113
132
  - lib/ruby_units/cache.rb
114
133
  - lib/ruby_units/date.rb
134
+ - lib/ruby_units/definition.rb
115
135
  - lib/ruby_units/fixnum.rb
116
136
  - lib/ruby_units/math.rb
117
137
  - lib/ruby_units/numeric.rb
@@ -121,23 +141,14 @@ files:
121
141
  - lib/ruby_units/time.rb
122
142
  - lib/ruby_units/unit.rb
123
143
  - lib/ruby_units/unit_definitions.rb
144
+ - lib/ruby_units/unit_definitions/base.rb
145
+ - lib/ruby_units/unit_definitions/prefix.rb
146
+ - lib/ruby_units/unit_definitions/standard.rb
124
147
  - lib/ruby_units/version.rb
125
148
  - ruby-units.gemspec
126
- - spec/ruby-units/array_spec.rb
127
- - spec/ruby-units/complex_spec.rb
128
- - spec/ruby-units/date_spec.rb
129
- - spec/ruby-units/math_spec.rb
130
- - spec/ruby-units/numeric_spec.rb
131
- - spec/ruby-units/object_spec.rb
132
- - spec/ruby-units/string/extra_spec.rb
133
- - spec/ruby-units/string_spec.rb
134
- - spec/ruby-units/time_spec.rb
135
- - spec/ruby-units/unit_spec.rb
136
- - spec/spec_helper.rb
137
- - test/test_cache.rb
138
- - test/test_ruby-units.rb
139
149
  homepage: https://github.com/olbrich/ruby-units
140
- licenses: []
150
+ licenses:
151
+ - MIT
141
152
  post_install_message: ! '====================
142
153
 
143
154
  Deprecation Warning
@@ -170,8 +181,8 @@ post_install_message: ! '====================
170
181
  Pass in a Date, Time, or DateTime object to get the expected result.
171
182
 
172
183
 
173
- They will probably go away completely in an upcoming release, so it would be a good
174
- idea to refactor your code
184
+ They will go away completely in the next release, so it would be a good idea to
185
+ refactor your code
175
186
 
176
187
  to avoid using them. They will also throw deprecation warnings when they are used.
177
188
 
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- group :development do
4
- gem 'bundler', '~> 1.0'
5
- gem 'rcov', :platforms => :mri_18
6
- gem 'jeweler'
7
- gem 'rspec', '~>2.5'
8
- gem 'autotest', :platforms => [:mri_18, :mri_19]
9
- gem 'autotest-growl', :platforms => [:mri_18, :mri_19]
10
- gem 'autotest-fsevent', :platforms => [:mri_18, :mri_19]
11
- end
12
-
data/Manifest.txt DELETED
@@ -1,19 +0,0 @@
1
- CHANGELOG.txt
2
- Manifest.txt
3
- README.md
4
- LICENSE.txt
5
- Rakefile
6
- lib/ruby-units.rb
7
- lib/ruby_units.rb
8
- lib/ruby_units/units.rb
9
- lib/ruby_units/math.rb
10
- lib/ruby_units/date.rb
11
- lib/ruby_units/time.rb
12
- lib/ruby_units/string.rb
13
- lib/ruby_units/array.rb
14
- lib/ruby_units/numeric.rb
15
- lib/ruby_units/object.rb
16
- lib/ruby_units/array.rb
17
- lib/ruby_units/complex.rb
18
- lib/ruby_units/ruby-units.rb
19
- test/test_ruby-units.rb
data/autotest/discover.rb DELETED
@@ -1 +0,0 @@
1
- Autotest.add_discovery { "rspec2" }
@@ -1,14 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Array do
4
-
5
- subject { [1, 'cm'] }
6
-
7
- it {should be_kind_of Array}
8
- it {should respond_to :to_unit}
9
-
10
- specify { subject.to_unit.should be_instance_of Unit}
11
- specify { subject.to_unit.should == "1 cm".to_unit }
12
- specify { subject.to_unit('mm').should == "10 mm".to_unit}
13
-
14
- end
@@ -1,37 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- # Complex numbers are a bit strange
4
- # Technically you can't really compare them using <=>, and ruby 1.9 does not implement this method for them
5
- # so it stands to reason that complex units should also not support :> or :<
6
-
7
- describe Complex do
8
- subject { Complex(1,1) }
9
- it { should respond_to :to_unit }
10
- end
11
-
12
- describe "Complex Unit" do
13
- subject { Complex(1.0, -1.0).to_unit }
14
-
15
- it { should be_instance_of Unit}
16
- it(:scalar) { should be_kind_of Complex }
17
-
18
- it { should == "1-1i".to_unit }
19
- it { should === "1-1i".to_unit }
20
-
21
- if RUBY_VERSION < "1.9"
22
- context "in Ruby < 1.9" do
23
- it "is comparable" do
24
- subject.should > "1+0.5i".to_unit
25
- subject.should < "2+1i".to_unit
26
- end
27
- end
28
- else
29
- context "in Ruby >= 1.9" do
30
- it "is not comparable" do
31
- expect { subject > "1+1i".to_unit }.to raise_error(NoMethodError)
32
- expect { subject < "1+1i".to_unit }.to raise_error(NoMethodError)
33
- end
34
- end
35
- end
36
-
37
- end
@@ -1,38 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Date do
4
- subject { Date.new(2011,4,1) }
5
-
6
- it {should be_instance_of Date}
7
- it {should respond_to :to_unit}
8
- it {should respond_to :to_time}
9
- it {should respond_to :to_date}
10
-
11
- specify { (subject + "5 days".unit).should == Date.new(2011,4,6) }
12
- specify { (subject - "5 days".unit).should == Date.new(2011,3,27) }
13
- # 2012 is a leap year...
14
- specify { (subject + "1 year".unit).should == Date.new(2012,3,31) }
15
- specify { (subject - "1 year".unit).should == Date.new(2010,4,1) }
16
- end
17
-
18
- describe "Date Unit" do
19
-
20
- subject { Date.new(2011,4,1).to_unit }
21
-
22
- it { should be_instance_of Unit }
23
- its(:scalar) { should be_kind_of Rational }
24
- its(:units) { should == "d" }
25
- its(:kind) { should == :time }
26
-
27
- specify { (subject + "5 days".unit).should == Date.new(2011,4,6) }
28
- specify { (subject - "5 days".unit).should == Date.new(2011,3,27) }
29
-
30
- specify { expect { subject + Date.new(2011,4,1) }.to raise_error(ArgumentError) }
31
- specify { expect { subject + DateTime.new(2011,4,1,12,00,00) }.to raise_error(ArgumentError) }
32
- specify { expect { subject + Time.parse("2011-04-01 12:00:00") }.to raise_error(ArgumentError) }
33
-
34
- specify { (subject - Date.new(2011,4,1)).should be_zero }
35
- specify { (subject - DateTime.new(2011,4,1,00,00,00)).should be_zero }
36
- specify { expect {(subject - Time.parse("2011-04-01 00:00"))}.to raise_error(ArgumentError) }
37
- specify { (Date.new(2011,4,1) + 1).should == Date.new(2011,4,2)}
38
- end
@@ -1,63 +0,0 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
2
-
3
- describe Math do
4
- context "with '1 mm^6'" do
5
- subject { '1 mm^6'.to_unit }
6
-
7
- specify { Math.sqrt(subject).should == '1 mm^3'.to_unit }
8
- specify { Math.sqrt(4).should == 2 }
9
-
10
- if RUBY_VERSION > "1.9"
11
- # cbrt is only defined in Ruby > 1.9
12
- specify { Math.cbrt(subject).should == '1 mm^2'.to_unit }
13
- specify { Math.cbrt(8).should == 2 }
14
- end
15
-
16
- end
17
-
18
- context "Trigonometry functions" do
19
-
20
- context "with '45 deg' unit" do
21
- subject { "45 deg".unit }
22
- specify { Math.sin(subject).should be_within(0.01).of(0.70710678) }
23
- specify { Math.cos(subject).should be_within(0.01).of(0.70710678) }
24
- specify { Math.tan(subject).should be_within(0.01).of(1) }
25
- specify { Math.sinh(subject).should be_within(0.01).of(0.8686709614860095) }
26
- specify { Math.cosh(subject).should be_within(0.01).of(1.3246090892520057) }
27
- specify { Math.tanh(subject).should be_within(0.01).of(0.6557942026326724) }
28
- end
29
-
30
- context "with 'PI/4 radians' unit" do
31
- subject { (Math::PI/4).unit('radians') }
32
- specify { Math.sin(subject).should be_within(0.01).of(0.70710678) }
33
- specify { Math.cos(subject).should be_within(0.01).of(0.70710678) }
34
- specify { Math.tan(subject).should be_within(0.01).of(1) }
35
- specify { Math.sinh(subject).should be_within(0.01).of(0.8686709614860095) }
36
- specify { Math.cosh(subject).should be_within(0.01).of(1.3246090892520057) }
37
- specify { Math.tanh(subject).should be_within(0.01).of(0.6557942026326724) }
38
- end
39
-
40
- context "with 'PI/4' continues to work" do
41
- subject { (Math::PI/4) }
42
- specify { Math.sin(subject).should be_within(0.01).of(0.70710678) }
43
- specify { Math.cos(subject).should be_within(0.01).of(0.70710678) }
44
- specify { Math.tan(subject).should be_within(0.01).of(1) }
45
- specify { Math.sinh(subject).should be_within(0.01).of(0.8686709614860095) }
46
- specify { Math.cosh(subject).should be_within(0.01).of(1.3246090892520057) }
47
- specify { Math.tanh(subject).should be_within(0.01).of(0.6557942026326724) }
48
- end
49
-
50
- specify { Math.hypot("1 m".unit, "2 m".unit).should be_within("0.01 m".unit).of("2.23607 m".unit) }
51
- specify { Math.hypot("1 m".unit, "2 ft".unit).should be_within("0.01 m".unit).of("1.17116 m".unit) }
52
- specify { expect {Math.hypot("1 m".unit, "2 lbs".unit) }.to raise_error(ArgumentError) }
53
-
54
- specify { Math.atan2("1 m".unit, "2 m".unit).should be_within(0.01).of(0.4636476090008061) }
55
- specify { Math.atan2("1 m".unit, "2 ft".unit).should be_within(0.01).of(1.0233478888629426) }
56
- specify { Math.atan2(1,1).should be_within(0.01).of(0.785398163397448)}
57
- specify { expect {Math.atan2("1 m".unit, "2 lbs".unit)}.to raise_error(ArgumentError) }
58
-
59
- end
60
-
61
-
62
-
63
- end