Sha256: bf31d46867092c12d30db9e2b0e2b2e558062cd91383488eb739a2081613da3a

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

# coding: utf-8

# A072066
A072066 = [8,16,24,32,48,64,72,80,96,108,112,128,144,160,
           162,176,192,208,216,224,243,256,272,288,304,320,
           324,352,368,384,416,432,448,464,480,486,496,512,
           544,576,592,608,640,648,656,672,688,704,729,736,
           752,768,832,848]

describe Integer, "#exceptional?" do
  A072066.sample(10).each do |n|
    it "returns true for exceptional number #{n}" do
      n.should be_exceptional
    end
  end

  ([*(1..7)] + A072066.to_seq.invert.to_a).sample(10).each do |n|
    it "returns false for ordinary number #{n}" do
      n.should_not be_exceptional
    end
  end
end

describe Integer, "#ordinary?" do
  ([*(1..7)] + A072066.to_seq.invert.to_a).sample(10).each do |n|
    it "returns true for ordinary number #{n}" do
      n.should be_ordinary
    end
  end

  A072066.sample(10).each do |n|
    it "returns false for exceptional number #{n}" do
      n.should_not be_ordinary
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
numb-0.186.0 spec/numb/exceptional_spec.rb
numb-0.185.0 spec/numb/exceptional_spec.rb
numb-0.184.0 spec/numb/exceptional_spec.rb