Sha256: a7f8ddeb06f9c413c4f3b773fab392fcbe4b482a192f89be4ab713efa647150b

Contents?: true

Size: 837 Bytes

Versions: 2

Compression:

Stored size: 837 Bytes

Contents

require 'minitest/autorun'
require 'sarah'

class TestSarah < MiniTest::Unit::TestCase

    def test_stack
	s = Sarah.new
	s.push 1, 2, 3
	s.unshift 4, 5, 6
	assert_equal([4, 5, 6, 1, 2, 3], s.seq, "push + unshift")
	assert_equal(4, s.shift, "shift")
	assert_equal(3, s.pop, "pop")
	assert_equal([5, 6, 1, 2], s.seq, "after shift, pop")
    end

    def test_append
	s = Sarah.new
	s.append! [1], { :one => 1 }, [2], [3]
	s.append! [4], { :two => 2 }, [5], [6]
	assert_equal([1, 2, 3, 4, 5, 6], s.seq, "append ary")
	assert_equal({ :one => 1, :two => 2 }, s.rnd, "append hsh")
    end

    def test_insert
	s = Sarah.new
	s.insert! [1], { :one => 1 }, [2], [3]
	s.insert! [4], { :two => 2 }, [5], [6]
	assert_equal([4, 5, 6, 1, 2, 3], s.seq, "insert ary")
	assert_equal({ :one => 1, :two => 2 }, s.rnd, "insert hsh")
    end

end

# END

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sarah-0.0.2 test/04stack.rb
sarah-0.0.1 test/04stack.rb