Sha256: ec9cf19dc70dd4ec85cf2b29a86ee8ca93187c14e08813c689590b79df22d44f

Contents?: true

Size: 1.17 KB

Versions: 396

Compression:

Stored size: 1.17 KB

Contents

local perfect_numbers = require('perfect-numbers')

describe('perfect-numbers', function()
  it('should be able to calculate the Aliquot sum of a number with no divisors', function()
    assert.equal(0, perfect_numbers.aliquot_sum(1))
  end)

  it('should be able to calculate the Aliquot sum of a number with a single divisor', function()
    assert.equal(1, perfect_numbers.aliquot_sum(2))
  end)

  it('should be able to calculate the Aliquot sum of a number with a multiple divisors', function()
    assert.equal(15, perfect_numbers.aliquot_sum(16))
  end)

  it('should be able to calculate the Aliquot sum of a large number', function()
    assert.equal(229, perfect_numbers.aliquot_sum(1115))
  end)

  it('should classify numbers whose Aliquot sum is less than itself as deficient', function()
    assert.equal('deficient', perfect_numbers.classify(13))
  end)

  it('should classify numbers whose Aliquot sum is equal to itself as perfect', function()
    assert.equal('perfect', perfect_numbers.classify(28))
  end)

  it('should classify numbers whose Aliquot sum is greater than itself as abundant', function()
    assert.equal('abundant', perfect_numbers.classify(12))
  end)
end)

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.179 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.178 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.177 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.176 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.175 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.174 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.173 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.172 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.171 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.170 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.169 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.167 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.166 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.165 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.164 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.163 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.162 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.161 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua
trackler-2.2.1.160 tracks/lua/exercises/perfect-numbers/perfect-numbers_spec.lua