Changeset 15287 for trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3
- Timestamp:
- 07/26/17 15:48:32 (7 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources
- Property svn:mergeinfo changed
/branches/Async (added) merged: 13329,13349,13354-13355,13401,15065,15190,15204,15212,15215-15216,15232,15280-15281,15284,15286
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Tests
- Property svn:mergeinfo changed
/branches/Async/HeuristicLab.Tests (added) merged: 13355,13401,15065,15280-15281
- Property svn:mergeinfo changed
-
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/CollectObjectGraphTest.cs
r14185 r15287 24 24 using System.Diagnostics; 25 25 using System.Linq; 26 using System.Threading;27 26 using System.Threading.Tasks; 28 27 using HeuristicLab.Algorithms.GeneticAlgorithm; … … 125 124 algs.Add(ga); 126 125 127 var cancellationTokenSource = new CancellationTokenSource(); 128 ga.StartSync(cancellationTokenSource.Token); 126 ga.Start(); 129 127 sw.Stop(); 130 128 TestContext.WriteLine("{0}: {1} ", i, sw.Elapsed); … … 157 155 var sw = new Stopwatch(); 158 156 sw.Start(); 159 ga.Start Sync(new CancellationToken());157 ga.Start(); 160 158 sw.Stop(); 161 159 Console.WriteLine("{0}; Objects after execution: {1}", ga.Name, ga.GetObjectGraphObjects().Count()); -
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/GeneticAlgorithmTest.cs
r14185 r15287 21 21 22 22 using System; 23 using System.Threading;24 23 using HeuristicLab.Algorithms.GeneticAlgorithm; 25 24 using HeuristicLab.Common; … … 39 38 } 40 39 41 private EventWaitHandle trigger = new AutoResetEvent(false);42 40 private Exception ex; 43 41 … … 49 47 GeneticAlgorithm ga = (GeneticAlgorithm)XmlParser.Deserialize(@"Test Resources\GA_TSP.hl"); 50 48 ga.ExceptionOccurred += new EventHandler<EventArgs<Exception>>(ga_ExceptionOccurred); 51 ga.Stopped += new EventHandler(ga_Stopped);52 49 ga.SetSeedRandomly.Value = false; 53 50 ga.Seed.Value = 0; … … 55 52 ga.Prepare(); 56 53 ga.Start(); 57 trigger.WaitOne();58 54 if (ex != null) throw ex; 59 55 … … 80 76 ex = e.Value; 81 77 } 82 83 private void ga_Stopped(object sender, EventArgs e) {84 trigger.Set();85 }86 78 } 87 79 } -
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SamplesUtils.cs
r13237 r15287 1 1 using System; 2 2 using System.Linq; 3 using System.Threading;4 3 using HeuristicLab.Algorithms.ALPS; 5 4 using HeuristicLab.Algorithms.EvolutionStrategy; … … 18 17 19 18 public static void RunAlgorithm(IAlgorithm a) { 20 var trigger = new EventWaitHandle(false, EventResetMode.ManualReset);21 19 Exception ex = null; 22 a.Stopped += (src, e) => { trigger.Set(); }; 23 a.ExceptionOccurred += (src, e) => { ex = e.Value; trigger.Set(); }; 20 a.ExceptionOccurred += (sender, e) => { ex = e.Value; }; 24 21 a.Prepare(); 25 22 a.Start(); 26 trigger.WaitOne(); 27 28 Assert.AreEqual(ex, null); 23 Assert.IsNull(ex); 29 24 } 30 25
Note: See TracChangeset
for help on using the changeset viewer.