tape_measure 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tape_measure/parser.rb +7 -2
- data/lib/tape_measure/version.rb +1 -1
- data/spec/tape_measure/parser_spec.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07320203954dff2f3a7bb0752bb30ef17ca04edd
|
4
|
+
data.tar.gz: 3c82a17ce14afc4742e7888c848def08b9f6308b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 981b263f657144e96b6bd263332e61faf7d06e6ed059ae54b12ab55b494474f8feefc90245f4c451917622138c48164e9a8d01539f37a8d56d63fcc27eb3938d
|
7
|
+
data.tar.gz: ebaff9f5840153a4ae9d15b597064326b6db4dc39f3aaf68797273753a84afe500e4186105b08ab1613890886bcbe7d2295add41cb9619a54a80ff755822363b
|
data/lib/tape_measure/parser.rb
CHANGED
data/lib/tape_measure/version.rb
CHANGED
@@ -21,6 +21,19 @@ describe TapeMeasure do
|
|
21
21
|
# 1' 2' 3' 127cm
|
22
22
|
# 5 (assumes inches)
|
23
23
|
# 3-3/4" = 2.75
|
24
|
+
|
25
|
+
it 'can handle integer' do
|
26
|
+
TapeMeasure.parse(6).should eq 6
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'can handle nil' do
|
30
|
+
TapeMeasure.parse(nil).should eq nil
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'can handle empty string' do
|
34
|
+
TapeMeasure.parse("").should eq nil
|
35
|
+
end
|
36
|
+
|
24
37
|
describe :grammar do
|
25
38
|
it 'can add' do
|
26
39
|
TapeMeasure::Parser.new('(8+2)').value.should eq 10
|
@@ -28,7 +41,6 @@ describe TapeMeasure do
|
|
28
41
|
TapeMeasure::Parser.new('(8 + 2)').value.should eq 10
|
29
42
|
TapeMeasure::Parser.new('8 + 2').value.should eq 10
|
30
43
|
end
|
31
|
-
|
32
44
|
it 'can subtract' do
|
33
45
|
TapeMeasure::Parser.new('4 - 2').value.should eq 2
|
34
46
|
end
|