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.180 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.179 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.178 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.177 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.176 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.175 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.174 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.173 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.172 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.171 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.170 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.169 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.167 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.166 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.165 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.164 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.163 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.162 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.161 tracks/lua/exercises/prime-factors/prime-factors_spec.lua
trackler-2.2.1.160 tracks/lua/exercises/prime-factors/prime-factors_spec.lua