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.139 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.138 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.137 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.136 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.135 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.134 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.133 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.132 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.131 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.130 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.129 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.128 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.127 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.126 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.125 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.124 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.123 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.122 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.121 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.120 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua