Sha256: 04b6569043eb0c7225c020beedd416e23d6d1433f3c2965053f8196a43d32f59

Contents?: true

Size: 1008 Bytes

Versions: 334

Compression:

Stored size: 1008 Bytes

Contents

local rle = require('run-length-encoding')

describe('run-length-encoding', function()
  it('should encode simple strings', function()
    assert.equal('2A3B4C', rle.encode('AABBBCCCC'))
  end)

  it('should encode strings with multi-digit run lengths', function()
    assert.equal('2A10B4C', rle.encode('AABBBBBBBBBBCCCC'))
  end)

  it('should decode simple strings', function()
    assert.equal('AABBBCCCC', rle.decode('2A3B4C'))
  end)

  it('should decode strings with multi-digit run lengths', function()
    assert.equal('AABBBBBBBBBBCCCC', rle.decode('2A10B4C'))
  end)

  it('should not encode characters with a run length of 1', function()
    assert.equal('2AB4CD', rle.encode('AABCCCCD'))
  end)

  it('should successfully decode characters with a run length of 1', function()
    assert.equal('AABCCCCD', rle.decode('2AB4CD'))
  end)

  it('should decode an encoded string back to the original string', function()
    assert.equal('zzz ZZ  zZ', rle.decode(rle.encode('zzz ZZ  zZ')))
  end)
end)

Version data entries

334 entries across 334 versions & 1 rubygems

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