Skip to content

Commit 587e0b0

Browse files
committed
Tests for Comparable. Still not all path coverage.
1 parent 73d7000 commit 587e0b0

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

test/t/comparable.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
assert('<', '15.3.3.2.1') do
3+
class Foo
4+
include Comparable
5+
def <=>(x)
6+
0
7+
end
8+
end
9+
10+
(Foo.new < Foo.new) == false
11+
end
12+
13+
assert('<=', '15.3.3.2.2') do
14+
class Foo
15+
include Comparable
16+
def <=>(x)
17+
0
18+
end
19+
end
20+
21+
(Foo.new <= Foo.new) == true
22+
end
23+
24+
assert('==', '15.3.3.2.3') do
25+
class Foo
26+
include Comparable
27+
def <=>(x)
28+
0
29+
end
30+
end
31+
32+
(Foo.new == Foo.new) == true
33+
end
34+
35+
assert('>', '15.3.3.2.4') do
36+
class Foo
37+
include Comparable
38+
def <=>(x)
39+
0
40+
end
41+
end
42+
43+
(Foo.new > Foo.new) == false
44+
end
45+
46+
assert('>=', '15.3.3.2.5') do
47+
class Foo
48+
include Comparable
49+
def <=>(x)
50+
0
51+
end
52+
end
53+
54+
(Foo.new >= Foo.new) == true
55+
end
56+

0 commit comments

Comments
 (0)