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