You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
808 B
38 lines
808 B
14 years ago
|
#!/usr/bin/env ruby
|
||
|
# -*- ruby -*-
|
||
|
|
||
|
require File.expand_path(File.dirname(__FILE__) + '/edgecase')
|
||
|
|
||
|
class AboutAsserts < EdgeCase::Koan
|
||
|
|
||
|
def test_assert_truth
|
||
14 years ago
|
assert true
|
||
14 years ago
|
end
|
||
|
|
||
|
def test_assert_with_message
|
||
14 years ago
|
assert true, "This should be true -- Please fix this"
|
||
14 years ago
|
end
|
||
|
|
||
|
# To understand reality, we must compare our expectations against
|
||
|
# reality.
|
||
|
def test_assert_equality
|
||
14 years ago
|
expected_value = 2
|
||
14 years ago
|
actual_value = 1 + 1
|
||
|
|
||
|
assert expected_value == actual_value
|
||
|
end
|
||
|
|
||
|
# Some ways of asserting equality are better than others.
|
||
|
def test_a_better_way_of_asserting_equality
|
||
14 years ago
|
expected_value = 2
|
||
14 years ago
|
actual_value = 1 + 1
|
||
|
|
||
|
assert_equal expected_value, actual_value
|
||
|
end
|
||
|
|
||
|
# Sometimes we will ask you to fill in the values
|
||
|
def test_fill_in_values
|
||
14 years ago
|
assert_equal 2, 1 + 1
|
||
14 years ago
|
end
|
||
|
end
|