Skip to content

Commit

Permalink
Mistakenly, GetFloat was used where GetInt was needed. Fixed it.
Browse files Browse the repository at this point in the history
Extended test case to ReflexionGraph.
  • Loading branch information
koschke committed May 31, 2024
1 parent 7e30849 commit 5b3c093
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Assets/SEETests/TestGraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using SEE.Tools.ReflexionAnalysis;

namespace SEE.DataModel.DG
{
Expand Down Expand Up @@ -775,8 +776,7 @@ public void TestDeleteTree()
/// <summary>
/// Tests <see cref="Graph.SubgraphBy"/>.
/// </summary>
[Test]
public void TestSubgraph()
private void TestSubgraph<T>() where T : Graph, new()
{
const string floatAttribute = "float";
const string intAttribute = "int";
Expand All @@ -788,7 +788,7 @@ public void TestSubgraph()
const string stringAttributeValue = "hello, world";
const bool toggleAttributeValue = true;

Graph g = NewEmptyGraph();
Graph g = new T();
g.SetFloat(floatAttribute, floatAttributeValue);
g.SetInt(intAttribute, intAttributeValue);
g.SetString(stringAttribute, stringAttributeValue);
Expand All @@ -800,12 +800,24 @@ public void TestSubgraph()

Graph sg = g.SubgraphBy(x => x is Node || (x is Edge e && e.Type == "set"));
Assert.AreEqual(floatAttributeValue, sg.GetFloat(floatAttribute));
Assert.AreEqual(intAttributeValue, sg.GetFloat(intAttribute));
Assert.AreEqual(intAttributeValue, sg.GetInt(intAttribute));
Assert.AreEqual(stringAttributeValue, sg.GetString(stringAttribute));
Assert.IsTrue(sg.HasToggle(toggleAttribute));

Assert.AreEqual(2, sg.NodeCount);
Assert.AreEqual(1, sg.EdgeCount);
}

[Test]
public void TestSubgraphGraph()
{
TestSubgraph<Graph>();
}

[Test]
public void TestSubgraphReflexionGraph()
{
TestSubgraph<ReflexionGraph>();
}
}
}

0 comments on commit 5b3c093

Please sign in to comment.