Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created August 6, 2009 11:31
Show Gist options
  • Save leehambley/163261 to your computer and use it in GitHub Desktop.
Save leehambley/163261 to your computer and use it in GitHub Desktop.
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