Skip to content

Instantly share code, notes, and snippets.

@apeiros
Created March 17, 2010 22:52
Show Gist options
  • Save apeiros/335829 to your computer and use it in GitHub Desktop.
Save apeiros/335829 to your computer and use it in GitHub Desktop.
BareTest.suite "Integer Division" do
data :integer_division, :csv, <<-DATA
@divident, @divisor, @expected_quotient
1, 1, 1
1, 2, 0
2, 2, 1
DATA
setup :addition, data(:addition)
assert ":@divident divided by :@divisor returns an integer" do
@actual_quotient = @divident/@divisor
kind_of Integer, @actual_quotient
end
assert ":@divident divided by :@divisor equals :@expected_quotient" do
@actual_quotient = @divident/@divisor
equal @expected_quotient, @actual_quotient
end
end
Integer Division
[ success ] 1 divided by 1 returns an integer
[ success ] 1 divided by 2 returns an integer
[ success ] 2 divided by 2 returns an integer
[ success ] 1 divided by 1 equals 1
[ success ] 1 divided by 2 equals 0
[ success ] 2 divided by 2 equals 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment