Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion exercises/practice/list-ops/.meta/tests.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ reimplements = "be396a53-c074-4db3-8dd6-f7ed003cce7c"
description = "reverse the elements of the list -> empty list"

[fcc03d1e-42e0-4712-b689-d54ad761f360]
description = "reverse the elements of the list -> non-empty list"
description = "reverse the elements of the list -> non-empty even-length list"

[64d77184-5f74-4845-b158-545d2dd2df98]
description = "reverse the elements of the list -> non-empty odd-length list"

[40872990-b5b8-4cb8-9085-d91fc0d05d26]
description = "reverse the elements of the list -> list of lists is not flattened"
8 changes: 7 additions & 1 deletion exercises/practice/list-ops/list-ops_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,18 @@ describe('list-ops', function()
assert.are.same(expected, actual)
end)

it('non-empty list', function()
it('non-empty even-length list', function()
local expected = { 7, 5, 3, 1 }
local actual = list_ops.reverse({ 1, 3, 5, 7 })
assert.are.same(expected, actual)
end)

it('non-empty odd-length list', function()
local expected = { 13, 11, 9, 7, 5, 3, 1 }
local actual = list_ops.reverse({ 1, 3, 5, 7, 9, 11, 13 })
assert.are.same(expected, actual)
end)

it('list of lists is not flattened', function()
local expected = { { 4, 5, 6 }, {}, { 3 }, { 1, 2 } }
local actual = list_ops.reverse({ { 1, 2 }, { 3 }, {}, { 4, 5, 6 } })
Expand Down
Loading