Sha256: 3ed13d4195d3bd4e7d60f281e76196c0823a1af7462618bc06e9581c4cb0b951

Contents?: true

Size: 625 Bytes

Versions: 20

Compression:

Stored size: 625 Bytes

Contents

describe Integer, "#centered_triangular?" do
  # A005448
  @seq = [1,4,10,19,31,46,64,85,109,136,166,199,235,274,
          316,361,409,460,514,571,631,694,760,829,901,976,
          1054,1135,1219,1306,1396,1489,1585,1684,1786,1891,
          1999,2110,2224,2341,2461,2584,2710,2839,2971,3106,
          3244,3385,3529].to_seq

  @seq.each do |n|
    it "returns true for centered triangular number #{n}" do
      n.should be_centered_triangular
    end
  end

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

Version data entries

20 entries across 20 versions & 1 rubygems

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