Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11782


Ignore:
Timestamp:
01/16/15 10:00:25 (10 years ago)
Author:
mkommend
Message:

#2295: Excluded empty arrays in the report of the DeepClonableCloningTest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/DeepCloneableCloningTest.cs

    r11514 r11782  
    119119    private bool ProcessEqualObjects(IDeepCloneable item, IEnumerable<object> intersections) {
    120120      bool success = true;
    121       TestContext.WriteLine(Environment.NewLine + item.GetType().FullName + ":");
     121      bool headerWritten = false;
     122
    122123      foreach (object o in intersections) {
    123124        string typeName = o.GetType().FullName;
     
    126127        } else if (o is IDeepCloneable) {
    127128          string info = (o is IItem) ? ((IItem)o).ItemName + ((o is INamedItem) ? ", " + ((INamedItem)o).Name : String.Empty) : String.Empty;
     129          if (!headerWritten) {
     130            TestContext.WriteLine(Environment.NewLine + item.GetType().FullName + ":");
     131            headerWritten = true;
     132          }
    128133          TestContext.WriteLine("POTENTIAL ERROR! A DEEPCLONEABLE WAS NOT DEEP CLONED (" + info + "): " + typeName);
    129134          success = false;
    130         } else
     135        } else {
     136          Array array = o as Array;
     137          if (array != null && array.Length == 0) continue; //arrays of length 0 are used inside empty collectionss
     138          if (!headerWritten) {
     139            TestContext.WriteLine(Environment.NewLine + item.GetType().FullName + ":");
     140            headerWritten = true;
     141          }
    131142          TestContext.WriteLine("WARNING: An object of type " + typeName + " is referenced in the original and in the clone.");
     143        }
    132144      }
    133145      return success;
Note: See TracChangeset for help on using the changeset viewer.