Sha256: 2c5025904d0e116a227e094c8ec80ac08f667d09004be01d0a2f9f554b323cd1

Contents?: true

Size: 1.43 KB

Versions: 396

Compression:

Stored size: 1.43 KB

Contents

local diamond = require 'diamond'

describe('diamond', function()
  it('should generate the diamond for A', function()
    assert.are.equal('A\n', diamond('A'))
  end)

  it('should generate the diamond for B', function()
    local expected =
      ' A \n' ..
      'B B\n' ..
      ' A \n'

    assert.are.equal(expected, diamond('B'))
  end)

  it('should generate the diamond for C', function()
    local expected =
      '  A  \n' ..
      ' B B \n' ..
      'C   C\n' ..
      ' B B \n' ..
      '  A  \n'

    assert.are.equal(expected, diamond('C'))
  end)

  it('should generate the diamond for E', function()
    local expected =
      '    A    \n' ..
      '   B B   \n' ..
      '  C   C  \n' ..
      ' D     D \n' ..
      'E       E\n' ..
      ' D     D \n' ..
      '  C   C  \n' ..
      '   B B   \n' ..
      '    A    \n'

    assert.are.equal(expected, diamond('E'))
  end)

  it('should generate the diamond for H', function()
    local expected =
      '       A       \n' ..
      '      B B      \n' ..
      '     C   C     \n' ..
      '    D     D    \n' ..
      '   E       E   \n' ..
      '  F         F  \n' ..
      ' G           G \n' ..
      'H             H\n' ..
      ' G           G \n' ..
      '  F         F  \n' ..
      '   E       E   \n' ..
      '    D     D    \n' ..
      '     C   C     \n' ..
      '      B B      \n' ..
      '       A       \n'

    assert.are.equal(expected, diamond('H'))
  end)
end)

Version data entries

396 entries across 396 versions & 1 rubygems

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