Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tests for Comparable. Still not all path coverage.

  • Loading branch information...
commit 587e0b0137234ee4d8b18430d41f7cf07569a732 1 parent 73d7000
@monaka monaka authored
Showing with 56 additions and 0 deletions.
  1. +56 −0 test/t/comparable.rb
View
56 test/t/comparable.rb
@@ -0,0 +1,56 @@
+
+assert('<', '15.3.3.2.1') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ 0
+ end
+ end
+
+ (Foo.new < Foo.new) == false
+end
+
+assert('<=', '15.3.3.2.2') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ 0
+ end
+ end
+
+ (Foo.new <= Foo.new) == true
+end
+
+assert('==', '15.3.3.2.3') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ 0
+ end
+ end
+
+ (Foo.new == Foo.new) == true
+end
+
+assert('>', '15.3.3.2.4') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ 0
+ end
+ end
+
+ (Foo.new > Foo.new) == false
+end
+
+assert('>=', '15.3.3.2.5') do
+ class Foo
+ include Comparable
+ def <=>(x)
+ 0
+ end
+ end
+
+ (Foo.new >= Foo.new) == true
+end
+
Please sign in to comment.
Something went wrong with that request. Please try again.