Skip to content

Commit df53cc3

Browse files
committed
Merge remote-tracking branch 'origin/master' into improve_mutation_of_directives
2 parents da24233 + f7c0a71 commit df53cc3

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

src/Stryker.Core/Stryker.Core.UnitTest/Mutants/CsharpMutantOrchestratorTests.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1953,11 +1953,13 @@ public void ShouldProtectDirectives()
19531953
}";
19541954
var expected = @"public void SomeMethod() {if(StrykerNamespace.MutantControl.IsActive(0)){}else{
19551955
var x = 0;
1956-
if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){ #if !DEBUG
1956+
#if !DEBUG
1957+
if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){
19571958
x--;
1958-
}else{ #if !DEBUG
1959+
}else{
19591960
x++;
1960-
}} #endif
1961+
}}
1962+
#endif
19611963
}}";
19621964

19631965
ShouldMutateSourceInClassToExpected(source, expected);

src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs

+10-7
Original file line numberDiff line numberDiff line change
@@ -542,20 +542,20 @@ private static StringBuilder BuildReferenceChoice(IEnumerable<string> projectRef
542542

543543
private sealed class DynamicEnumerableQueue<T>
544544
{
545-
private readonly Queue<T> _queue;
546-
private readonly HashSet<T> _cache;
545+
private readonly ConcurrentQueue<T> _queue;
546+
private readonly ConcurrentDictionary<T, bool> _cache;
547547

548548
public DynamicEnumerableQueue(IEnumerable<T> init)
549549
{
550-
_cache = [.. init];
551-
_queue = new Queue<T>(_cache);
550+
_cache = new(init.ToDictionary(x => x, x => true));
551+
_queue = new (_cache.Keys);
552552
}
553553

554-
public bool Empty => _queue.Count == 0;
554+
public bool Empty => _queue.IsEmpty;
555555

556556
public void Add(T entry)
557557
{
558-
if (!_cache.Add(entry))
558+
if (!_cache.TryAdd(entry, true))
559559
{
560560
return;
561561
}
@@ -566,7 +566,10 @@ public IEnumerable<T> Consume()
566566
{
567567
while (_queue.Count > 0)
568568
{
569-
yield return _queue.Dequeue();
569+
if (_queue.TryDequeue(out var entry))
570+
{
571+
yield return entry;
572+
}
570573
}
571574
}
572575
}

src/Stryker.Core/Stryker.Core/Mutants/CsharpMutantOrchestrator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private static List<INodeOrchestrator> BuildOrchestratorList() =>
6262
new MemberAccessExpressionOrchestrator<SimpleNameSyntax>(),
6363
new MemberAccessExpressionOrchestrator<PostfixUnaryExpressionSyntax>(t =>
6464
t.IsKind(SyntaxKind.SuppressNullableWarningExpression)),
65-
// ensure patterhsyntax nodes are mutated (as they are neither expression nor statements, they are not mutated by default)
65+
// ensure pattern syntax nodes are mutated (as they are neither expression nor statements, they are not mutated by default)
6666
new NodeSpecificOrchestrator<PatternSyntax, PatternSyntax>(),
6767
new NodeSpecificOrchestrator<SubpatternSyntax, SubpatternSyntax>(),
6868
new ConditionalExpressionOrchestrator(),

0 commit comments

Comments
 (0)