|
| 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 | +} |
0 commit comments