Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into improve_mutation_of…
Browse files Browse the repository at this point in the history
…_directives
  • Loading branch information
dupdob committed Nov 22, 2024
2 parents da24233 + f7c0a71 commit f5bbfd9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1953,11 +1953,13 @@ public void ShouldProtectDirectives()
}";
var expected = @"public void SomeMethod() {if(StrykerNamespace.MutantControl.IsActive(0)){}else{
var x = 0;
if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){ #if !DEBUG
#if !DEBUG
if(StrykerNamespace.MutantControl.IsActive(1)){;}else{if(StrykerNamespace.MutantControl.IsActive(2)){
x--;
}else{ #if !DEBUG
}else{
x++;
}} #endif
}}
#endif
}}";

ShouldMutateSourceInClassToExpected(source, expected);
Expand Down
17 changes: 10 additions & 7 deletions src/Stryker.Core/Stryker.Core/Initialisation/InputFileResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,20 @@ private static StringBuilder BuildReferenceChoice(IEnumerable<string> projectRef

private sealed class DynamicEnumerableQueue<T>
{
private readonly Queue<T> _queue;
private readonly HashSet<T> _cache;
private readonly ConcurrentQueue<T> _queue;
private readonly ConcurrentDictionary<T, bool> _cache;

public DynamicEnumerableQueue(IEnumerable<T> init)
{
_cache = [.. init];
_queue = new Queue<T>(_cache);
_cache = new(init.ToDictionary(x => x, x => true));
_queue = new (_cache.Keys);
}

public bool Empty => _queue.Count == 0;
public bool Empty => _queue.IsEmpty;

public void Add(T entry)
{
if (!_cache.Add(entry))
if (!_cache.TryAdd(entry, true))
{
return;
}
Expand All @@ -566,7 +566,10 @@ public IEnumerable<T> Consume()
{
while (_queue.Count > 0)
{
yield return _queue.Dequeue();
if (_queue.TryDequeue(out var entry))
{
yield return entry;
}
}
}
}
Expand Down

0 comments on commit f5bbfd9

Please sign in to comment.