1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
import 'org.jruby.ir.util.Edge'
import 'org.jruby.ir.util.Vertex'
import 'org.jruby.ir.util.DirectedGraph'
describe "Edge" do
before do
@graph = DirectedGraph.new
end
describe "toString" do
context "When edge type is not null" do
it "represents edge with type" do
edge = Edge.new(Vertex.new(@graph, "foo", 1), Vertex.new(@graph, "bar", 2), "baz")
expect(edge.toString).to eq "<1 --> 2> (baz)"
end
end
context "When edge type is null" do
it "represents edge without type" do
edge = Edge.new(Vertex.new(@graph, "foo", 1), Vertex.new(@graph, "bar", 2), nil)
expect(edge.toString).to eq "<1 --> 2>"
end
end
end
end
|