File tree Expand file tree Collapse file tree 4 files changed +15
-25
lines changed
tests/BenchmarkDotNet.Tests Expand file tree Collapse file tree 4 files changed +15
-25
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,7 @@ private static ImmutableHashSet<IValidator> GetValidators(IEnumerable<IValidator
215215 /// </summary>
216216 private static IReadOnlyList < Job > GetRunnableJobs ( IEnumerable < Job > jobs )
217217 {
218- var unique = jobs . Distinct ( ) . ToArray ( ) ;
218+ var unique = jobs . Distinct ( JobComparer . Instance ) . ToArray ( ) ;
219219 var result = new List < Job > ( ) ;
220220
221221 foreach ( var standardJob in unique . Where ( job => ! job . Meta . IsMutator && ! job . Meta . IsDefault ) )
Original file line number Diff line number Diff line change @@ -60,7 +60,7 @@ [PublicAPI] protected string GetConfigurationFlag() => Configuration == RuntimeI
6060 ? ""
6161 : Configuration ;
6262
63- [ PublicAPI ] protected string GetDebuggerFlag ( ) => HasAttachedDebugger ? " [AttachedDebugger]" : "" ;
63+ [ PublicAPI ] protected string GetDebuggerFlag ( ) => HasAttachedDebugger ? "[AttachedDebugger]" : "" ;
6464 [ PublicAPI ] protected string GetGcServerFlag ( ) => IsServerGC ? "Server" : "Workstation" ;
6565 [ PublicAPI ] protected string GetGcConcurrentFlag ( ) => IsConcurrentGC ? "Concurrent" : "Non-concurrent" ;
6666
Original file line number Diff line number Diff line change @@ -19,6 +19,19 @@ namespace BenchmarkDotNet.Tests.Configs
1919{
2020 public class ImmutableConfigTests
2121 {
22+ [ Fact ]
23+ public void DuplicateJobsAreExcluded ( )
24+ {
25+ var mutable = ManualConfig . CreateEmpty ( ) ;
26+
27+ mutable . AddJob ( new Job ( ) ) ;
28+ mutable . AddJob ( new Job ( ) ) ;
29+
30+ var final = ImmutableConfigBuilder . Create ( mutable ) ;
31+
32+ Assert . Single ( final . GetJobs ( ) ) ;
33+ }
34+
2235 [ Fact ]
2336 public void DuplicateColumnProvidersAreExcluded ( )
2437 {
Original file line number Diff line number Diff line change @@ -94,29 +94,6 @@ public void CustomClrBuildJobsAreGroupedByVersion()
9494 Assert . Equal ( 3 * 2 , grouping . Count ( ) ) ; // (M1 + M2 + M3) * (Plain1 + Plain2)
9595 }
9696
97- [ Fact ]
98- public void CustomNuGetJobsWithSamePackageVersionAreGroupedTogether ( )
99- {
100- var job1 = Job . Default . WithNuGet ( "AutoMapper" , "7.0.1" ) ;
101- var job2 = Job . Default . WithNuGet ( "AutoMapper" , "7.0.1" ) ;
102-
103- var config = ManualConfig . Create ( DefaultConfig . Instance )
104- . AddJob ( job1 )
105- . AddJob ( job2 ) ;
106-
107- var benchmarks1 = BenchmarkConverter . TypeToBenchmarks ( typeof ( Plain1 ) , config ) ;
108- var benchmarks2 = BenchmarkConverter . TypeToBenchmarks ( typeof ( Plain2 ) , config ) ;
109-
110- var grouped = benchmarks1 . BenchmarksCases . Union ( benchmarks2 . BenchmarksCases )
111- . GroupBy ( benchmark => benchmark , new BenchmarkPartitioner . BenchmarkRuntimePropertiesComparer ( ) )
112- . ToArray ( ) ;
113-
114- Assert . Single ( grouped ) ; // 7.0.1
115-
116- foreach ( var grouping in grouped )
117- Assert . Equal ( 2 * 3 * 2 , grouping . Count ( ) ) ; // ((job1 + job2) * (M1 + M2 + M3) * (Plain1 + Plain2)
118- }
119-
12097 [ Fact ]
12198 public void CustomNuGetJobsAreGroupedByPackageVersion ( )
12299 {
You can’t perform that action at this time.
0 commit comments