class MyListClassTests
Public Class Methods
in_sequence(sequence)
click to toggle source
# File lib/testing.rb, line 127 def self.in_sequence(sequence) ARGV[0] =~ /#{sequence}/ || ARGV[0].nil? || ARGV[0] =~ /RECORD/ end
Public Instance Methods
test_append()
click to toggle source
# File lib/testing.rb, line 142 def test_append my_list = MyList.new([1, 2, 3]) my_list.append(4) assert_equal [1, 2, 3, 4], my_list.contents assert_includes my_list.contents, 4 end
test_contents()
click to toggle source
# File lib/testing.rb, line 137 def test_contents assert_equal [1, 2, 3], MyList.new([1, 2, 3]).contents end
test_find_first_position_of()
click to toggle source
# File lib/testing.rb, line 150 def test_find_first_position_of my_list = MyList.new([1, 2, 3, 2, 5]) assert_equal 1, my_list.find_first_position_of(2) assert_equal 0, my_list.find_first_position_of(1) assert_equal 4, my_list.find_first_position_of(5) end
test_find_positions_of()
click to toggle source
# File lib/testing.rb, line 159 def test_find_positions_of my_list = MyList.new([1, 2, 3, 2, 5]) assert_equal [1, 3], my_list.find_positions_of(2) assert_equal [0], my_list.find_positions_of(1) assert_equal [4], my_list.find_positions_of(5) end
test_maximum()
click to toggle source
# File lib/testing.rb, line 167 def test_maximum my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12]) assert_equal 16, my_list.maximum my_list = MyList.new([12, 2, 33, 2, 5, 16, 7, 12]) assert_equal 33, my_list.maximum end
test_min_max()
click to toggle source
# File lib/testing.rb, line 183 def test_min_max my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12]) assert_equal [1, 16], my_list.min_max my_list = MyList.new([12, 2, 33, 2, 5, 16, 7, 12]) assert_equal [2, 33], my_list.min_max my_list = MyList.new([12, 1, 2, 3, 2, 25, 16, 7]) assert_equal [1, 25], my_list.min_max end
test_minimum()
click to toggle source
# File lib/testing.rb, line 175 def test_minimum my_list = MyList.new([1, 2, 3, 2, 5, 16, 7, 12]) assert_equal 1, my_list.minimum my_list = MyList.new([12, 1, 2, 3, 2, 25, 16, 7]) assert_equal 1, my_list.minimum end
test_new()
click to toggle source
# File lib/testing.rb, line 132 def test_new assert_kind_of MyList, MyList.new([1, 2, 3]) end