Sha256: 37fb1fffcc933817254d2a6a75273685a58f4e37728442070c46189a9eb9b74d
Contents?: true
Size: 1.05 KB
Versions: 2
Compression:
Stored size: 1.05 KB
Contents
require 'helper' class TestConv < Test::Unit::TestCase context "A Loop instance " do setup do @al = Loop.new([1,2,3,4,5,"hog","cannon","globe"]) end should "be class loop" do assert_equal @al.class, Loop end @expected_methods = %w[next prev forward backward current set_position position] @expected_methods.each do |m| should "respond to #{m}" do assert_respond_to(@al, m) end end should "go next and prev" do c = @al.current n = @al.next b = @al.prev assert_equal c,b end should "loop from end of array back to begining" do @al.set_position(@al.size - 1) # last element #the "next" element after the last should be the first #element assert_equal @al.next, @al.first end should "loop from begining to end when stepping backwards" do @al.set_position(0) #first element #the "prev" element should be the same as the last element assert_equal @al.prev,@al.last end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
conv-0.0.3 | test/test_loop.rb |
conv-0.0.2 | test/test_loop.rb |