infinity 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/infinity.gemspec +4 -1
- data/lib/infinity.rb +2 -32
- data/test/helper.rb +1 -0
- data/test/test_infinity.rb +27 -2
- metadata +18 -5
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/danielb2/infinity"
|
12
12
|
gem.authors = ["Daniel Bretoi"]
|
13
13
|
gem.files = FileList["[a-zA-Z]*", "{bin,generators,lib,test}/**/*"]
|
14
|
-
|
14
|
+
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/infinity.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{infinity}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.6"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Daniel Bretoi"]
|
@@ -42,9 +42,12 @@ Gem::Specification.new do |s|
|
|
42
42
|
s.specification_version = 3
|
43
43
|
|
44
44
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
45
46
|
else
|
47
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
46
48
|
end
|
47
49
|
else
|
50
|
+
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
48
51
|
end
|
49
52
|
end
|
50
53
|
|
data/lib/infinity.rb
CHANGED
@@ -12,6 +12,8 @@ class Infinity
|
|
12
12
|
self
|
13
13
|
end
|
14
14
|
def *(obj)
|
15
|
+
return 0 if obj == 0 or obj == 0.0
|
16
|
+
return nil if obj == nil
|
15
17
|
self
|
16
18
|
end
|
17
19
|
def >(obj)
|
@@ -28,35 +30,3 @@ class Infinity
|
|
28
30
|
include Methods
|
29
31
|
extend Methods
|
30
32
|
end
|
31
|
-
|
32
|
-
if $0 == __FILE__
|
33
|
-
eval DATA.read, nil, $0, __LINE__+4
|
34
|
-
end
|
35
|
-
|
36
|
-
__END__
|
37
|
-
|
38
|
-
require 'test/unit'
|
39
|
-
|
40
|
-
class TC_Infinity < Test::Unit::TestCase
|
41
|
-
def test_arithmatic
|
42
|
-
assert_equal(Infinity, (Infinity + 23))
|
43
|
-
assert_equal(Infinity, (Infinity - 23))
|
44
|
-
assert_equal(Infinity, (Infinity / 23))
|
45
|
-
assert_equal(Infinity, (Infinity * 23))
|
46
|
-
assert_equal(1, (Infinity / Infinity))
|
47
|
-
assert_equal(1, (Infinity.new / Infinity))
|
48
|
-
assert_equal(1, (Infinity.new / Infinity.new))
|
49
|
-
end
|
50
|
-
|
51
|
-
def test_comparable
|
52
|
-
assert(Infinity > 23)
|
53
|
-
assert_equal(false, Infinity < 23)
|
54
|
-
assert(Infinity == Infinity)
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_string
|
58
|
-
assert_equal("Infinity", "#{Infinity}")
|
59
|
-
assert_equal("Infinity", Infinity.to_s)
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
data/test/helper.rb
CHANGED
data/test/test_infinity.rb
CHANGED
@@ -1,7 +1,32 @@
|
|
1
1
|
require 'helper'
|
2
2
|
|
3
3
|
class TestInfinity < Test::Unit::TestCase
|
4
|
-
should "
|
5
|
-
|
4
|
+
should "test arithmatic" do
|
5
|
+
assert_equal(Infinity, (Infinity + 23))
|
6
|
+
assert_equal(Infinity, (Infinity - 23))
|
7
|
+
assert_equal(Infinity, (Infinity / 23))
|
8
|
+
assert_equal(Infinity, (Infinity * 23))
|
9
|
+
assert_equal(1, (Infinity / Infinity))
|
10
|
+
assert_equal(1, (Infinity.new / Infinity))
|
11
|
+
assert_equal(1, (Infinity.new / Infinity.new))
|
12
|
+
assert_equal(0, Infinity * 0)
|
13
|
+
assert_equal(nil, Infinity * nil)
|
14
|
+
end
|
15
|
+
|
16
|
+
should "test comparable" do
|
17
|
+
assert(Infinity > 23)
|
18
|
+
assert_equal(false, Infinity < 23)
|
19
|
+
assert(Infinity == Infinity)
|
20
|
+
end
|
21
|
+
|
22
|
+
should "test string" do
|
23
|
+
assert_equal("Infinity", "#{Infinity}")
|
24
|
+
assert_equal("Infinity", Infinity.to_s)
|
25
|
+
end
|
26
|
+
|
27
|
+
context "zero" do
|
28
|
+
should "divide by zero" do
|
29
|
+
assert_equal(Infinity, 9/0)
|
30
|
+
end
|
6
31
|
end
|
7
32
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infinity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Bretoi
|
@@ -17,8 +17,21 @@ cert_chain: []
|
|
17
17
|
|
18
18
|
date: 2010-07-07 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thoughtbot-shoulda
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :development
|
34
|
+
version_requirements: *id001
|
22
35
|
description: simple lib to deal with infinate numbers
|
23
36
|
email: daniel@netwalk.org
|
24
37
|
executables: []
|