phys-units 0.9.9 → 1.0.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.
- checksums.yaml +4 -4
- data/.travis.yml +18 -0
- data/Gemfile +3 -0
- data/README.md +12 -2
- data/Rakefile +7 -0
- data/lib/phys/units/load_units.rb +1205 -179
- data/lib/phys/units/parse.rb +36 -31
- data/lib/phys/units/parse.y +19 -14
- data/lib/phys/units/version.rb +1 -1
- data/misc/mkunitspec.rb +14 -13
- data/spec/all_units_spec.rb +802 -125
- data/spec/helper.rb +0 -1
- data/spec/jp_units_spec.rb +0 -1
- data/spec/quantity_spec.rb +5 -7
- data/spec/unit_spec.rb +8 -9
- data/spec/utils_spec.rb +0 -1
- metadata +4 -3
data/spec/helper.rb
CHANGED
data/spec/jp_units_spec.rb
CHANGED
data/spec/quantity_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
1
|
require "helper"
|
3
2
|
|
4
3
|
describe "Phys::Quantity" do
|
@@ -151,19 +150,19 @@ describe "Phys::Quantity" do
|
|
151
150
|
its(:value){is_expected.to eq 2.5}
|
152
151
|
end
|
153
152
|
describe "tempC*tempC" do
|
154
|
-
it {expect{Q[1,"tempC"]*Q[2,"tempC"]}.to raise_error}
|
153
|
+
it {expect{Q[1,"tempC"]*Q[2,"tempC"]}.to raise_error(Phys::UnitError)}
|
155
154
|
end
|
156
155
|
describe "tempC*K" do
|
157
|
-
it {expect{Q[1,"tempC"]*Q[2,"K"]}.to raise_error}
|
156
|
+
it {expect{Q[1,"tempC"]*Q[2,"K"]}.to raise_error(Phys::UnitError)}
|
158
157
|
end
|
159
158
|
describe "K*tempC" do
|
160
|
-
it {expect{Q[1,"K"]*Q[2,"tempC"]}.to raise_error}
|
159
|
+
it {expect{Q[1,"K"]*Q[2,"tempC"]}.to raise_error(Phys::UnitError)}
|
161
160
|
end
|
162
161
|
describe "tempC**2" do
|
163
|
-
it {expect{Q[2,"tempC"]**2}.to raise_error}
|
162
|
+
it {expect{Q[2,"tempC"]**2}.to raise_error(Phys::UnitError)}
|
164
163
|
end
|
165
164
|
describe "tempC/tempC" do
|
166
|
-
it {expect{Q[2,"tempC"]/Q[1,"tempC"]}.to raise_error}
|
165
|
+
it {expect{Q[2,"tempC"]/Q[1,"tempC"]}.to raise_error(Phys::UnitError)}
|
167
166
|
end
|
168
167
|
end
|
169
168
|
|
@@ -192,4 +191,3 @@ describe "Phys::Quantity" do
|
|
192
191
|
end
|
193
192
|
|
194
193
|
end
|
195
|
-
|
data/spec/unit_spec.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
1
|
require "helper"
|
3
2
|
|
4
3
|
describe "Create Units" do
|
@@ -117,14 +116,14 @@ describe "Create Units" do
|
|
117
116
|
|
118
117
|
describe U['h'] do
|
119
118
|
it {is_expected.to be_an_instance_of Phys::Unit}
|
120
|
-
its(:factor) {is_expected.to be_within(1e-
|
121
|
-
its(:conversion_factor) {is_expected.to be_within(1e-
|
119
|
+
its(:factor) {is_expected.to be_within(1e-7*1e-33).of 6.626070040e-34}
|
120
|
+
its(:conversion_factor) {is_expected.to be_within(1e-7*1e-33).of 6.626070040e-34}
|
122
121
|
its(:name) {is_expected.to eq 'h'}
|
123
|
-
its(:expr) {is_expected.to eq "4.135667516e-15 eV s"}
|
122
|
+
#its(:expr) {is_expected.to eq "4.135667516e-15 eV s"}
|
124
123
|
its(:offset) {is_expected.to be_nil}
|
125
124
|
its(:dimension) {is_expected.to eq({'kg'=>1,'m'=>2,'s'=>-1})}
|
126
125
|
its(:dimension_value) {is_expected.to eq 1}
|
127
|
-
its(:string_form) {is_expected.to eq "6.626069574766962e-34 s^-1 kg m^2"}
|
126
|
+
#its(:string_form) {is_expected.to eq "6.626069574766962e-34 s^-1 kg m^2"}
|
128
127
|
it {is_expected.not_to be_dimensionless}
|
129
128
|
it {is_expected.not_to be_scalar}
|
130
129
|
it {is_expected.to be_operable}
|
@@ -132,14 +131,14 @@ describe "Create Units" do
|
|
132
131
|
|
133
132
|
describe U['e'] do
|
134
133
|
it {is_expected.to be_an_instance_of Phys::Unit}
|
135
|
-
its(:factor) {is_expected.to be_within(1e-
|
136
|
-
its(:conversion_factor) {is_expected.to be_within(1e-
|
134
|
+
its(:factor) {is_expected.to be_within(1e-7*1e-18).of 1.6021766208e-19}
|
135
|
+
its(:conversion_factor) {is_expected.to be_within(1e-7*1e-18).of 1.6021766208e-19}
|
137
136
|
its(:name) {is_expected.to eq 'e'}
|
138
|
-
its(:expr) {is_expected.to eq "1.602176565e-19 C"}
|
137
|
+
#its(:expr) {is_expected.to eq "1.602176565e-19 C"}
|
139
138
|
its(:offset) {is_expected.to be_nil}
|
140
139
|
its(:dimension) {is_expected.to eq({'A'=>1,'s'=>1})}
|
141
140
|
its(:dimension_value) {is_expected.to eq 1}
|
142
|
-
its(:string_form) {is_expected.to eq "1.602176565e-19 A s"}
|
141
|
+
#its(:string_form) {is_expected.to eq "1.602176565e-19 A s"}
|
143
142
|
it {is_expected.not_to be_dimensionless}
|
144
143
|
it {is_expected.not_to be_scalar}
|
145
144
|
it {is_expected.to be_operable}
|
data/spec/utils_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phys-units
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro TANAKA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -48,6 +48,7 @@ extensions: []
|
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
50
|
- ".gitignore"
|
51
|
+
- ".travis.yml"
|
51
52
|
- COPYING
|
52
53
|
- Gemfile
|
53
54
|
- README.md
|
@@ -99,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
100
|
version: '0'
|
100
101
|
requirements: []
|
101
102
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.
|
103
|
+
rubygems_version: 2.6.13
|
103
104
|
signing_key:
|
104
105
|
specification_version: 4
|
105
106
|
summary: Library for Unit conversion of Physical Quantities using GNU Units data.
|