Sha256: edc2304a143e8ed9a1cee2ab15ee37a4e25dd1096d4ef19d6ea50e5d17704c10

Contents?: true

Size: 1.08 KB

Versions: 396

Compression:

Stored size: 1.08 KB

Contents

local prime_factors = require('prime-factors')

describe('prime-factors', function()
  it('returns an empty array for 1', function()
    assert.are.same({}, prime_factors(1))
  end)

  it('factors 2', function()
    assert.are.same({ 2 }, prime_factors(2))
  end)

  it('factors 3', function()
    assert.are.same({ 3 }, prime_factors(3))
  end)

  it('factors 4', function()
    assert.are.same({ 2, 2 }, prime_factors(4))
  end)

  it('factors 6', function()
    assert.are.same({ 2, 3 }, prime_factors(6))
  end)

  it('factors 8', function()
    assert.are.same({ 2, 2, 2 }, prime_factors(8))
  end)

  it('factors 9', function()
    assert.are.same({ 3, 3 }, prime_factors(9))
  end)

  it('factors 27', function()
    assert.are.same({ 3, 3, 3 }, prime_factors(27))
  end)

  it('factors 625', function()
    assert.are.same({ 5, 5, 5, 5 }, prime_factors(625))
  end)

  it('factors 901255', function()
    assert.are.same({ 5, 17, 23, 461 }, prime_factors(901255))
  end)

  it('factors 93819012551', function()
    assert.are.same({ 11, 9539, 894119 }, prime_factors(93819012551))
  end)
end)

Version data entries

396 entries across 396 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.158 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.157 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.156 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.155 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.154 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.153 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.152 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.151 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.150 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.149 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.148 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.147 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.146 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.145 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.144 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.143 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.142 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.141 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.140 tracks/lua/exercises/prime-factors/prime-factors_spec.lua