Skip to content

Commit e47e3f9

Browse files
committed
Adding more test and updating version for new release.
Has fixes for subgraphs and support for more attributes with updated Documentation
1 parent 64b9cee commit e47e3f9

File tree

4 files changed

+118
-1
lines changed

4 files changed

+118
-1
lines changed

Version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.1
1+
1.0.2
-20 MB
Binary file not shown.

src/UnitTest/DiagraphTest.cs

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using NUnit.Framework;
5+
using csdot;
6+
using csdot.Attributes.DataTypes;
7+
8+
9+
namespace UnitTest
10+
{
11+
public class DiagraphTest
12+
{
13+
Graph graph;
14+
[SetUp]
15+
public void Setup()
16+
{
17+
graph = new Graph("");
18+
graph.type = "digraph";
19+
}
20+
21+
[Test]
22+
public void full_diagraph()
23+
{
24+
List<Transition> transition = new List<Transition>()
25+
{
26+
new Transition("a", EdgeOp.directed),
27+
new Transition("b", EdgeOp.unspecified)
28+
};
29+
Edge edge = new Edge(transition);
30+
edge.Attribute.label.Value = "0.2";
31+
edge.Attribute.weight.Value = 0.2;
32+
graph.AddElement(edge);
33+
34+
transition = new List<Transition>()
35+
{
36+
new Transition("a", EdgeOp.directed),
37+
new Transition("c", EdgeOp.unspecified)
38+
};
39+
edge = new Edge(transition);
40+
edge.Attribute.label.Value = "0.4";
41+
edge.Attribute.weight.Value = 0.4;
42+
graph.AddElement(edge);
43+
44+
transition = new List<Transition>()
45+
{
46+
new Transition("c", EdgeOp.directed),
47+
new Transition("b", EdgeOp.unspecified)
48+
};
49+
edge = new Edge(transition);
50+
edge.Attribute.label.Value = "0.6";
51+
edge.Attribute.weight.Value = 0.6;
52+
graph.AddElement(edge);
53+
54+
transition = new List<Transition>()
55+
{
56+
new Transition("c", EdgeOp.directed),
57+
new Transition("e", EdgeOp.unspecified)
58+
};
59+
edge = new Edge(transition);
60+
edge.Attribute.label.Value = "0.6";
61+
edge.Attribute.weight.Value = 0.6;
62+
graph.AddElement(edge);
63+
64+
transition = new List<Transition>()
65+
{
66+
new Transition("e", EdgeOp.directed),
67+
new Transition("e", EdgeOp.unspecified)
68+
};
69+
edge = new Edge(transition);
70+
edge.Attribute.label.Value = "0.1";
71+
edge.Attribute.weight.Value = 0.1;
72+
graph.AddElement(edge);
73+
74+
transition = new List<Transition>()
75+
{
76+
new Transition("e", EdgeOp.directed),
77+
new Transition("b", EdgeOp.unspecified)
78+
};
79+
edge = new Edge(transition);
80+
edge.Attribute.label.Value = "0.7";
81+
edge.Attribute.weight.Value = 0.7;
82+
graph.AddElement(edge);
83+
84+
DotDocument ddoc = new DotDocument();
85+
ddoc.SaveToFile(graph, "C:\\git\\csdot\\Resources\\test\\output\\full_digraph.dot");
86+
Assert.Pass();
87+
88+
}
89+
}
90+
}

src/UnitTest/NodeTest.cs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using NUnit.Framework;
2+
using csdot;
3+
using csdot.Attributes.DataTypes;
4+
5+
namespace UnitTest
6+
{
7+
public class Tests
8+
{
9+
Graph graph;
10+
[SetUp]
11+
public void Setup()
12+
{
13+
graph = new Graph("test");
14+
}
15+
16+
[Test]
17+
public void Test1()
18+
{
19+
Node ethernet = new Node("ethernet");
20+
ethernet.Attribute.shape.Value = ShapeTypes.circle;
21+
ethernet.Attribute.color.Value = Color.X11.red;
22+
ethernet.Attribute.label.Value = "ethernet";
23+
graph.AddElement(ethernet);
24+
Assert.Pass();
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)