topiary 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -3
- data/Changelog +7 -0
- data/lib/topiary.rb +5 -1
- data/lib/topiary/directed_graph.rb +193 -0
- data/lib/topiary/edge.rb +18 -0
- data/lib/topiary/exceptions.rb +9 -0
- data/lib/topiary/graph.rb +21 -0
- data/lib/topiary/node.rb +5 -1
- data/lib/topiary/version.rb +1 -1
- data/spec/directed_graph_spec.rb +903 -0
- data/spec/topological_sort_spec.rb +3 -3
- metadata +7 -2
@@ -9,7 +9,7 @@ describe Topiary do
|
|
9
9
|
n.feed! n
|
10
10
|
expect {
|
11
11
|
Topiary.sort([n])
|
12
|
-
}.to raise_error "Leftover edges found: this graph has a cycle"
|
12
|
+
}.to raise_error Topiary::InvalidGraph, "Leftover edges found: this graph has a cycle"
|
13
13
|
end
|
14
14
|
|
15
15
|
it "raises on a two-node cycle" do
|
@@ -19,7 +19,7 @@ describe Topiary do
|
|
19
19
|
n2.feed! n1
|
20
20
|
expect {
|
21
21
|
Topiary.sort([n1, n2])
|
22
|
-
}.to raise_error "Leftover edges found: this graph has a cycle"
|
22
|
+
}.to raise_error Topiary::InvalidGraph, "Leftover edges found: this graph has a cycle"
|
23
23
|
end
|
24
24
|
|
25
25
|
it "raises on a three-node cycle" do
|
@@ -31,7 +31,7 @@ describe Topiary do
|
|
31
31
|
n3.feed! n1
|
32
32
|
expect {
|
33
33
|
Topiary.sort([n1, n2, n3])
|
34
|
-
}.to raise_error "Leftover edges found: this graph has a cycle"
|
34
|
+
}.to raise_error Topiary::InvalidGraph, "Leftover edges found: this graph has a cycle"
|
35
35
|
end
|
36
36
|
|
37
37
|
it "sorts a graph of one node" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: topiary
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul A. Jungwirth
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -98,9 +98,14 @@ files:
|
|
98
98
|
- README.md
|
99
99
|
- Rakefile
|
100
100
|
- lib/topiary.rb
|
101
|
+
- lib/topiary/directed_graph.rb
|
102
|
+
- lib/topiary/edge.rb
|
103
|
+
- lib/topiary/exceptions.rb
|
104
|
+
- lib/topiary/graph.rb
|
101
105
|
- lib/topiary/node.rb
|
102
106
|
- lib/topiary/version.rb
|
103
107
|
- marshmallows.jpg
|
108
|
+
- spec/directed_graph_spec.rb
|
104
109
|
- spec/node_spec.rb
|
105
110
|
- spec/spec_helper.rb
|
106
111
|
- spec/topological_sort_spec.rb
|