Skip to content

Instantly share code, notes, and snippets.

@craigmartin
Created August 2, 2011 11:34
Show Gist options
  • Save craigmartin/1120032 to your computer and use it in GitHub Desktop.
Save craigmartin/1120032 to your computer and use it in GitHub Desktop.
Test/Unit for sum 1to100 program
require 'test/unit'
class MathTester < Test::Unit::TestCase
def test_addition
assert_equal( 3, 1+2 )
assert_equal( 5, 2+3 )
end
def test_subtraction
assert_equal( 10, 20-10 )
end
def test_multiplication
assert_equal( 5, 5 * 1 )
end
def test_division
assert_equal( 10, 20 / 2 )
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment