Changeset 14932


Ignore:
Timestamp:
05/04/17 20:17:51 (21 months ago)
Author:
gkronber
Message:

#2520 check if results are the same for the GA TSP sample test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceReintegration/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs

    r14928 r14932  
    3030using System.Reflection;
    3131using System.Text;
     32using System.Threading;
    3233using System.Threading.Tasks;
    3334using HeuristicLab.Algorithms.GeneticAlgorithm;
     
    23352336      });
    23362337      ProtoBufSerializer serializer = new ProtoBufSerializer();
    2337       serializer.Serialize(test(), tempFile);
    2338       object o = serializer.Deserialize(tempFile);
     2338      GeneticAlgorithm original = test();
     2339      serializer.Serialize(original, tempFile);
     2340      object o = serializer.Deserialize(tempFile);
     2341
     2342      // this fails because old persistence didn't handle all IComparer ?
     2343      // Assert.AreEqual(DebugStringGenerator.Serialize(original),DebugStringGenerator.Serialize(o));
     2344
    23392345      GeneticAlgorithm result = (GeneticAlgorithm)o;
    23402346      SamplesUtils.RunAlgorithm(result);
    2341       GeneticAlgorithm original = test();
    23422347      SamplesUtils.RunAlgorithm(original);
    2343       //Assert.AreEqual(original.Results[""], result);
    2344 
    2345       //string msg = Profile(test);
    2346       //Console.WriteLine(msg);
    2347     }
     2348      Assert.AreEqual(((DoubleValue)result.Results["BestQuality"].Value).Value,
     2349        ((DoubleValue)original.Results["BestQuality"].Value).Value);
     2350
     2351      // Assert.AreEqual(DebugStringGenerator.Serialize(result), DebugStringGenerator.Serialize(result2));
     2352    }
     2353
    23482354    [TestMethod]
    23492355    [TestCategory("Persistence4")]
Note: See TracChangeset for help on using the changeset viewer.