Sha256: b8d1a333ad481e7ffd3c3f0ff8842ffe5829a8cb7e78240157e0c7c50466b9d9

Contents?: true

Size: 669 Bytes

Versions: 20

Compression:

Stored size: 669 Bytes

Contents

describe Integer, "#deficient?" do
  # A005100
  @seq = [1,2,3,4,5,7,8,9,10,11,13,14,15,16,17,19,21,22,23,
          25,26,27,29,31,32,33,34,35,37,38,39,41,43,44,45,
          46,47,49,50,51,52,53,55,57,58,59,61,62,63,64,65,
          67,68,69,71,73,74,75,76,77,79,81,82,83,85,86].to_seq

  @seq.each do |n|
    it "should return true for deficient number #{n}" do
      n.should be_deficient
    end

    it "should return false for negative deficient number #{-n}" do
      (-n).should_not be_deficient
    end
  end

  @seq.invert.sample(10).each do |n|
    it "should return false for non-deficient number #{n}" do
      n.should_not be_deficient
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
numb-0.186.0 spec/numb/deficient_spec.rb
numb-0.185.0 spec/numb/deficient_spec.rb
numb-0.184.0 spec/numb/deficient_spec.rb
numb-0.181.0 spec/numb/deficient_spec.rb
numb-0.170.0 spec/numb/deficient_spec.rb
numb-0.152.0 spec/numb/deficient_spec.rb
numb-0.138.0 spec/numb/deficient_spec.rb
numb-0.125.0 spec/numb/deficient_spec.rb
numb-0.114.0 spec/numb/deficient_spec.rb
numb-0.111.0 spec/numb/deficient_spec.rb
numb-0.109.0 spec/numb/deficient_spec.rb
numb-0.99.0 spec/numb/deficient_spec.rb
numb-0.96.0 spec/numb/deficient_spec.rb
numb-0.89.0 spec/numb/deficient_spec.rb
numb-0.84.0 spec/deficient_spec.rb
numb-0.77.0 spec/deficient_spec.rb
numb-0.72.1 spec/deficient_spec.rb
numb-0.72.0 spec/deficient_spec.rb
numb-0.68.0 spec/deficient_spec.rb
numb-0.63.0 spec/deficient_spec.rb