Skip to content

Instantly share code, notes, and snippets.

@xtoddx
Created September 10, 2010 01:14
Show Gist options
  • Save xtoddx/572887 to your computer and use it in GitHub Desktop.
Save xtoddx/572887 to your computer and use it in GitHub Desktop.
require 'test/unit'
#
# The goal for this exercise is to get the test to pass while not returning the
# expected value.
#
# CompTest may be renamed, as may CompEntry, so don't rely on names.
#
class CompEntry
def add addend_a, addend_b
addend_a + addend_b
end
def multiply term_a, term_b
term_a * term_b
end
end
class CompTest < Test::Unit::TestCase
def test_add
assert_equal 10, CompEntry.new.add(7, 3)
end
def test_multiply
assert_equal 100, CompEntry.new.multiply(50, 2)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment