temperature 1.0
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/COPYING +21 -0
- data/README +45 -0
- data/Rakefile +133 -0
- data/docs/temperature/classes/Numeric.html +619 -0
- data/docs/temperature/classes/String.html +167 -0
- data/docs/temperature/created.rid +1 -0
- data/docs/temperature/files/COPYING.html +133 -0
- data/docs/temperature/files/README.html +156 -0
- data/docs/temperature/files/lib/temperature_rb.html +123 -0
- data/docs/temperature/fr_class_index.html +28 -0
- data/docs/temperature/fr_file_index.html +29 -0
- data/docs/temperature/fr_method_index.html +42 -0
- data/docs/temperature/index.html +24 -0
- data/docs/temperature/rdoc-style.css +208 -0
- data/lib/temperature.rb +174 -0
- data/test/convert_test.rb +69 -0
- data/test/coverage/index.html +100 -0
- data/test/coverage/lib-temperature_rb.html +300 -0
- data/test/dewpoint_test.rb +16 -0
- data/test/num_test.rb +32 -0
- metadata +76 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
require "temperature"
|
5
|
+
|
6
|
+
class DewpointTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# the edgecase is funny, 0.5 degrees is about as close as you get
|
9
|
+
def test_dewpoint
|
10
|
+
(1..100).each do |temp|
|
11
|
+
assert_in_delta(temp, temp.dewpoint(100), 0.5)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
data/test/num_test.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
require "test/unit"
|
4
|
+
require "temperature"
|
5
|
+
|
6
|
+
class NumTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def test_F
|
9
|
+
numbers = [32.1, 23, -14.1, -7]
|
10
|
+
numbers.each do |num|
|
11
|
+
temp = num
|
12
|
+
assert_kind_of(Numeric, temp)
|
13
|
+
assert_equal(temp, num)
|
14
|
+
assert_equal(temp.units, "F")
|
15
|
+
assert(temp.is_F?)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_convert
|
20
|
+
f = [32.0, 212.0, -40.0, 32, 212, -40]
|
21
|
+
c = [0.0, 100.0, -40.0, 0, 100, -40]
|
22
|
+
k = [273.15, 373.15, 233.15, 273.15, 373.15, 233.15]
|
23
|
+
|
24
|
+
f.each_with_index do |n, i|
|
25
|
+
temp = n
|
26
|
+
assert_in_delta(temp.to_C, c[i], 0.00001)
|
27
|
+
assert_in_delta(temp.to_F, f[i], 0.00001)
|
28
|
+
assert_in_delta(temp.to_K, k[i], 0.00001)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: temperature
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "1.0"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sean Dague
|
8
|
+
autorequire: temperature
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-05 00:00:00 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: ""
|
17
|
+
email: sean@dague.net
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- COPYING
|
25
|
+
files:
|
26
|
+
- test/num_test.rb
|
27
|
+
- test/dewpoint_test.rb
|
28
|
+
- test/coverage/lib-temperature_rb.html
|
29
|
+
- test/coverage/index.html
|
30
|
+
- test/convert_test.rb
|
31
|
+
- lib/temperature.rb
|
32
|
+
- docs/temperature/files/lib/temperature_rb.html
|
33
|
+
- docs/temperature/files/README.html
|
34
|
+
- docs/temperature/files/COPYING.html
|
35
|
+
- docs/temperature/index.html
|
36
|
+
- docs/temperature/fr_method_index.html
|
37
|
+
- docs/temperature/created.rid
|
38
|
+
- docs/temperature/fr_class_index.html
|
39
|
+
- docs/temperature/classes/String.html
|
40
|
+
- docs/temperature/classes/Numeric.html
|
41
|
+
- docs/temperature/rdoc-style.css
|
42
|
+
- docs/temperature/fr_file_index.html
|
43
|
+
- Rakefile
|
44
|
+
- README
|
45
|
+
- COPYING
|
46
|
+
has_rdoc: true
|
47
|
+
homepage: http://github.com/sdague/temperature.rb
|
48
|
+
licenses: []
|
49
|
+
|
50
|
+
post_install_message:
|
51
|
+
rdoc_options:
|
52
|
+
- --main
|
53
|
+
- README
|
54
|
+
require_paths:
|
55
|
+
- lib
|
56
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
requirements: []
|
69
|
+
|
70
|
+
rubyforge_project:
|
71
|
+
rubygems_version: 1.3.5
|
72
|
+
signing_key:
|
73
|
+
specification_version: 3
|
74
|
+
summary: A ruby mixin for making Numerics temperatures
|
75
|
+
test_files: []
|
76
|
+
|