Sha256: 4dcc1a2670f7272e8fc69bcdda4e80f20c4cae08cb5fe1d50daf2650d636c43d

Contents?: true

Size: 672 Bytes

Versions: 20

Compression:

Stored size: 672 Bytes

Contents

describe Integer, "achilles?" do
  # A052486
  @seq = [72,108,200,288,392,432,500,648,675,800,864,968,
          972,1125,1152,1323,1352,1372,1568,1800,1944,2000,
          2312,2592,2700,2888,3087,3200,3267,3456,3528,3872,
          3888,4000,4232,4500,4563,4608,5000,5292,5324,5400,
          5408,5488].to_seq

  @seq.sample(10).each do |n|
    it "returns true for Achilles number #{n}" do
      n.should be_achilles
    end

    it "returns false for negative number #{-n}" do
      (-n).should_not be_achilles
    end
  end

  @seq.invert.sample(10).each do |n|
    it "returns false for non-Achilles number #{n}" do
      n.should_not be_achilles
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

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