Created
August 6, 2009 11:31
-
-
Save leehambley/163261 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'test/unit' | |
class Agent | |
attr_accessor :list | |
def initialize (list=[]) | |
self.list = list | |
end | |
def ==(other) | |
raise ArgumentError unless other.is_a? Agent | |
true if other.list.eql?(list) | |
end | |
end | |
class TestAgent < Test::Unit::TestCase | |
def setup | |
@red = Agent.new([1,2,3]) | |
@blue = Agent.new([1,2,3]) | |
@green = Agent.new([:a,:b,:c]) | |
end | |
def test_equal | |
assert_equal(@red, @blue) | |
end | |
def test_not_equal | |
assert_not_equal(@red, @green) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment