Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13510


Ignore:
Timestamp:
01/15/16 11:09:23 (8 years ago)
Author:
pfleck
Message:

#2557
Fixed wrong excluding of types in object graph traversal (no members were traversed any more).
Added a unit test that verifies that GetObjectGraphObjects yields a reasonable number of objects.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/ObjectExtensions.cs

    r13494 r13510  
    7878             typeof(Delegate).IsAssignableFrom(type) ||
    7979             typeof(Pointer).IsAssignableFrom(type) ||
    80              type.Namespace != "System.Reflection.Emit" ||
     80             type.Namespace == "System.Reflection.Emit" ||
    8181             (type.HasElementType && ExcludeType(type.GetElementType()));
    8282    }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/CollectObjectGraphTest.cs

    r12012 r13510  
    4141      get { return testContextInstance; }
    4242      set { testContextInstance = value; }
     43    }
     44
     45    [TestMethod]
     46    [TestCategory("General")]
     47    [TestCategory("Essential")]
     48    [TestProperty("Time", "medium")]
     49    public void TestCount() {
     50      GeneticAlgorithm ga = (GeneticAlgorithm)XmlParser.Deserialize(@"Test Resources\GA_SymbReg.hl");
     51      var objects = ga.GetObjectGraphObjects().ToList();
     52
     53      // Should be 3982, but count may change slightly as members are added or removed
     54      Assert.IsTrue(objects.Count > 1, "Number of objects in the object graph seems to small.");
    4355    }
    4456
Note: See TracChangeset for help on using the changeset viewer.