blob: bdb308074b5187b56c2bbb7cab0c1802a942f627 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
require_relative '../../../spec_helper'
describe "Enumerator::ArithmeticSequence#hash" do
it "is based on begin, end, step and exclude_end?" do
1.step(10).hash.should be_an_instance_of(Integer)
1.step(10).hash.should == 1.step(10).hash
1.step(10, 5).hash.should == 1.step(10, 5).hash
(1..10).step.hash.should == (1..10).step.hash
(1...10).step(8).hash.should == (1...10).step(8).hash
# both have exclude_end? == false
(1..10).step(100).hash.should == 1.step(10, 100).hash
((1..10).step.hash == (1..11).step.hash).should == false
((1..10).step.hash == (1...10).step.hash).should == false
((1..10).step.hash == (1..10).step(2).hash).should == false
end
end
|