Sha256: 2d2d4f92914cd92337be7c9e50d0292de42281ac6b4709cfe7c9d5d7d91b5796
Contents?: true
Size: 983 Bytes
Versions: 2
Compression:
Stored size: 983 Bytes
Contents
require 'spec/helper' describe 'OrderedSet' do os = OrderedSet.new(1,2,3,1) it 'should create sets' do OrderedSet.new.should == [] os.should == OrderedSet.new([1,2,3,1]) end it 'should not contain duplicates' do os.should == [1,2,3] end it 'should not duplicate entries' do os << 4 os.should == [1,2,3,4] os << 4 os.should == [1,2,3,4] end it 'should append with push and prepend with unshift' do os.push 1 os.should == [2,3,4,1] os.unshift 1 os.should == [1,2,3,4] os.push [1,2] os.should == [1,2,3,4,[1,2]] os.unshift [1,2] os.should == [[1,2],1,2,3,4] end it 'should support Array#[]=' do os = OrderedSet.new(1) os.should == [1] os[0] = 1 os.should == [1] os[1,0] = [3,4,5,1] os.should == [3,4,5,1] os[0,0] = [1,2] os.should == [1,2,3,4,5] os[5..5] = [7,8,1,2] os.should == [3,4,5,7,8,1,2] os[1..2] = 3 os.should == [3,7,8,1,2] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ramaze-0.2.1 | spec/snippets/ordered_set.rb |
ramaze-0.2.0 | spec/snippets/ordered_set.rb |