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.119 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.118 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.117 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.116 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.115 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.114 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.113 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.111 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.110 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.109 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.108 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.107 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.106 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.105 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.104 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.103 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.102 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.101 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.100 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua
trackler-2.2.1.99 tracks/lua/exercises/run-length-encoding/run-length-encoding_spec.lua