Maintenance - Mise à jour mensuelle Lundi 6 Avril 2020 entre 7h00 et 9h00

Commit e9a43049 authored by ARohan's avatar ARohan

Cycle detection added to test

parent 5a6e1725
......@@ -25,6 +25,7 @@
<script src="tests/spec/RefreshNetwork.js"></script>
<script src="tests/spec/SideCompoundsNetwork.js"></script>
<script src="tests/spec/MapNetwork.js"></script>
<script src="tests/spec/CycleDetectionSpec.js"></script>
</head>
<body>
......
......@@ -2210,7 +2210,7 @@ metExploreD3.GraphLink = {
computePathHorizontal : function (startNode, firstPointX, firstPointY, endNode) {
// Compute the coordinates of the last point of the arc (the point in contact of the periphery of the target node)
var metaboliteStyle = metExploreD3.getMetaboliteStyle();
// Compute the coordinates of the control point used for drawing the path (it is the point where all the arc entering or all the arc exiting the starting node converge)
// Compute the coordinates of the control point used for drawing the path
var controlX = endNode.x;
var controlY = startNode.y;
if (firstPointX < startNode.x && controlX > firstPointX){
......@@ -2318,7 +2318,7 @@ metExploreD3.GraphLink = {
computePathVertical : function (startNode, firstPointX, firstPointY, endNode) {
// Compute the coordinates of the last point of the arc (the point in contact of the periphery of the target node)
var metaboliteStyle = metExploreD3.getMetaboliteStyle();
// Compute the coordinates of the control point used for drawing the path (it is the point where all the arc entering or all the arc exiting the starting node converge)
// Compute the coordinates of the control point used for drawing the path
var controlX = startNode.x;
var controlY = endNode.y;
if (firstPointY < startNode.y && controlY > firstPointY){
......
describe("GraphStyleEdition", function() {
var graph;
var flag;
beforeEach(function () {
graph = [[1], [2], [3], [4], [0,5], [6], [7], [0,3]];
flag = "Single";
});
describe("Johnson cycle enumeration algorithm", function() {
it("should return an array of array", function() {
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag) ).toBeDefined();
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All") ).toBeDefined();
expect( typeof metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag) ).toBe(typeof []);
expect( typeof metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All") ).toBe(typeof []);
expect( typeof metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag)[0] ).toBe(typeof []);
expect( typeof metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All")[0] ).toBe(typeof []);
});
it("should return the correct number of cycles", function() {
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag).length ).toBe(2);
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All").length ).toBe(3);
});
it("the cycles returned should be the expected ones", function() {
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag)[0] ).toEqual([0, 1, 2, 3, 4]);
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, flag)[1] ).toEqual([0, 1, 2, 3, 4, 5, 6, 7]);
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All")[0] ).toEqual([0, 1, 2, 3, 4]);
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All")[1] ).toEqual([0, 1, 2, 3, 4, 5, 6, 7]);
expect( metExploreD3.GraphFunction.JohnsonAlgorithm(graph, "All")[2] ).toEqual([3, 4, 5, 6, 7]);
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment