Skip to content

Commit

Permalink
rename module "tree" to "treelua"
Browse files Browse the repository at this point in the history
Trying to fix https://ci.appveyor.com/project/starius/tree-lua/build/0.0.1.13-test/job/bv3eivbam6kf1axy#L678
Probably there is already a module with name "tree".
  • Loading branch information
starius committed Jun 26, 2015
1 parent a4190e1 commit ebb5a03
Show file tree
Hide file tree
Showing 20 changed files with 102 additions and 102 deletions.
36 changes: 18 additions & 18 deletions spec/Graph_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe("tree.Graph", function()
it("creates a graph from nodes and edges", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand All @@ -17,20 +17,20 @@ describe("tree.Graph", function()
end)

it("can't create en empty graph", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
assert.has_error(function()
local graph = Graph({}, {})
end)
end)

it("can create a graph with no edges", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local graph = Graph({a}, {})
end)

it("can't make a loop", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
assert.has_error(function()
local a = {}
local graph = Graph({a}, {
Expand All @@ -40,7 +40,7 @@ describe("tree.Graph", function()
end)

it("can't use edges of unknown nodes", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
assert.has_error(function()
Expand All @@ -51,7 +51,7 @@ describe("tree.Graph", function()
end)

it("can't use double edges", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
assert.has_error(function()
Expand All @@ -63,7 +63,7 @@ describe("tree.Graph", function()
end)

it("extracts edge", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local graph = Graph({a, b}, {
Expand All @@ -74,7 +74,7 @@ describe("tree.Graph", function()
end)

it("iterates all edges", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand All @@ -100,15 +100,15 @@ describe("tree.Graph", function()
end)

it("gets nodes", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local graph = Graph({a}, {})
assert.equal(1, #graph:nodes())
assert.equal(a, graph:nodes()[1])
end)

it("iterates nodes", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local graph = Graph({a}, {})
local it = graph:iterNodes()
Expand All @@ -120,7 +120,7 @@ describe("tree.Graph", function()
-- a - b - c - e
-- |
-- d - f
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand All @@ -135,7 +135,7 @@ describe("tree.Graph", function()
{d, f, {}},
})
local it = graph:iterBreadth(a)
local p = require 'tree.detail.arrayFromIt'(it)
local p = require 'treelua.detail.arrayFromIt'(it)
assert.truthy(p[1] == a)
assert.truthy(p[2] == b)
assert.truthy((p[3] == c and p[4] == d) or
Expand All @@ -148,7 +148,7 @@ describe("tree.Graph", function()
-- a - b - c - e
-- |
-- d - f
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand All @@ -163,7 +163,7 @@ describe("tree.Graph", function()
{d, f, {}},
})
local it = graph:iterDepth(a)
local p = require 'tree.detail.arrayFromIt'(it)
local p = require 'treelua.detail.arrayFromIt'(it)
assert.truthy(p[1] == a)
assert.truthy(p[2] == b)
assert.truthy((p[3] == c and p[4] == e
Expand All @@ -173,7 +173,7 @@ describe("tree.Graph", function()
end)

it("yields level, parent, edge from iterator", function()
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local edge = {}
Expand All @@ -189,7 +189,7 @@ describe("tree.Graph", function()
-- a - b - c - e
-- |
-- d - f
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand Down Expand Up @@ -222,7 +222,7 @@ describe("tree.Graph", function()
-- a - b - c - e
-- |
-- d - f
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand Down Expand Up @@ -268,7 +268,7 @@ describe("tree.Graph", function()
-- a - b - c - e
-- |
-- d - f
local Graph = require 'tree.Graph'
local Graph = require 'treelua.Graph'
local a = {}
local b = {}
local c = {}
Expand Down
50 changes: 25 additions & 25 deletions spec/Tree_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe("tree.Tree", function()
it("creates a tree from children list", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {}
local child1 = {}; local edge1 = {}
local child2 = {}; local edge2 = {}
Expand All @@ -16,7 +16,7 @@ describe("tree.Tree", function()
end)

it("throws if multiple roots", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent1 = {}
local child1 = {}
local parent2 = {}
Expand All @@ -30,7 +30,7 @@ describe("tree.Tree", function()
end)

it("throws if ownership is cyclic", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local node1 = {}
local node2 = {}
assert.has_error(function()
Expand All @@ -43,7 +43,7 @@ describe("tree.Tree", function()

it("throws if ownership is cyclic even if root exists",
function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local root = {}
local node1 = {}
local node2 = {}
Expand All @@ -57,7 +57,7 @@ describe("tree.Tree", function()
end)

it("gets root", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {}
local child1 = {}; local edge1 = {}
local child2 = {}; local edge2 = {}
Expand All @@ -78,7 +78,7 @@ D E
]]

it("gets parent of nodes", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {}
local B = {}
local C = {}
Expand Down Expand Up @@ -107,7 +107,7 @@ D E
end)

it("infers leafs in definition", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {}
local child1 = {}; local edge1 = {}
local child2 = {}; local edge2 = {}
Expand All @@ -118,7 +118,7 @@ D E
end)

it("returns if smth is a node", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {1}
local child1 = {2}; local edge1 = {22}
local child2 = {3}; local edge2 = {23}
Expand All @@ -144,7 +144,7 @@ D E
]]

it("gets if a node is leaf", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {}
local B = {}
local C = {}
Expand Down Expand Up @@ -172,7 +172,7 @@ D E
end

it("gets leafs", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}
local C = {3}
Expand All @@ -186,7 +186,7 @@ D E
local exp = {C, D, E}
table.sort(exp, cmpAsStrings)
-- iterator
local arrayFromIt = require 'tree.detail.arrayFromIt'
local arrayFromIt = require 'treelua.detail.arrayFromIt'
local leafs = arrayFromIt(tree:iterLeafs())
table.sort(leafs, cmpAsStrings)
assert.same(exp, leafs)
Expand All @@ -205,7 +205,7 @@ D E
end

it("gets #children of nodes", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {1}
local child1 = {2}; local edge1 = {22}
local child2 = {3}; local edge2 = {23}
Expand All @@ -227,7 +227,7 @@ D E
end)

it("gets children of nodes (larger example)", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand All @@ -247,7 +247,7 @@ D E
end)

it("gets edges of nodes", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {}
local child1 = {}; local edge1 = {}
local child2 = {}; local edge2 = {}
Expand All @@ -263,7 +263,7 @@ D E
end)

it("throws in edge() is called with non-nodes", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {}
local child1 = {}; local edge1 = {}
local child2 = {}; local edge2 = {}
Expand Down Expand Up @@ -303,7 +303,7 @@ D E
end)

it("gets nodes of tree", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local parent = {1}
local child1 = {2}; local edge1 = {}
local child2 = {3}; local edge2 = {}
Expand All @@ -320,7 +320,7 @@ D E
table.sort(nodes, cmpAsStrings)
assert.same(exp, nodes)
-- Method tree:iterNodes(), iterator
local arrayFromIt = require 'tree.detail.arrayFromIt'
local arrayFromIt = require 'treelua.detail.arrayFromIt'
local nodes = arrayFromIt(tree:iterNodes())
table.sort(nodes, cmpAsStrings)
assert.same(exp, nodes)
Expand All @@ -336,7 +336,7 @@ D E F G
]]

it("travere depth-first, starting from root", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -386,7 +386,7 @@ D E F G
]]

it("travere depth-first, starting from leaf", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -417,7 +417,7 @@ D E F G
end)

it("travere depth-first, starting from middle", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -448,7 +448,7 @@ D E F G
end)

it("travere breadth-first, starting from root", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -486,7 +486,7 @@ D E F G
end)

it("travere breadth-first, starting from leaf", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -522,7 +522,7 @@ D E F G
end)

it("travere breadth-first, starting from middle", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}; local edgeB = {22}
local C = {3}; local edgeC = {23}
Expand Down Expand Up @@ -558,7 +558,7 @@ D E F G
end)

it("throws if trying to traverse from non-node", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}
local tree = Tree {
Expand All @@ -570,7 +570,7 @@ D E F G
end)

it("convert to a graph", function()
local Tree = require 'tree.Tree'
local Tree = require 'treelua.Tree'
local A = {1}
local B = {2}
local C = {2}
Expand Down
2 changes: 1 addition & 1 deletion spec/detail/compat_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe("tree.detail.compat", function()
it("unpacks a table to mutiple result values", function()
local unpack = require 'tree.detail.compat'.unpack
local unpack = require 'treelua.detail.compat'.unpack
local a, b = unpack({1, 2})
assert.equal(1, a)
assert.equal(2, b)
Expand Down
Loading

0 comments on commit ebb5a03

Please sign in to comment.