Skip to content

Commit 2aa08aa

Browse files
Test tweaks.
1 parent bfc3f54 commit 2aa08aa

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

testing/Open.Collections.Tests/Collections/TrackedDictionaryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Open.Collections.Tests.Collections;
44
public class TrackedDictionaryTests
5-
: BasicDictionaryTests<TrackedDictionary<int, int>>
5+
: ParallelDictionaryTests<TrackedDictionary<int, int>>
66
{
77
public TrackedDictionaryTests()
88
: base(new (new Threading.ReadWriteModificationSynchronizer()))
@@ -11,7 +11,7 @@ public TrackedDictionaryTests()
1111
}
1212

1313
public class TrackedOrderedDictionaryTests
14-
: BasicDictionaryTests<TrackedOrderedDictionary<int, int>>
14+
: ParallelDictionaryTests<TrackedOrderedDictionary<int, int>>
1515
{
1616
public TrackedOrderedDictionaryTests()
1717
: base(new(new Threading.SimpleLockingModificationSynchronizer()))

testing/Open.Collections.Tests/ParallelDictionaryTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ protected ParallelDictionaryTests(TDictionary dictionary) : base(dictionary)
1515
[Fact]
1616
public void ParallelAddThenRemove()
1717
{
18-
const int count = 10000000;
18+
const int countAdd = 10000000;
1919
Dictionary.Clear();
20-
Parallel.For(0, count, i => Dictionary.Add(i, i));
21-
Dictionary.Count.Should().Be(count);
20+
Parallel.For(0, countAdd, i => Dictionary.Add(i, i));
21+
Dictionary.Count.Should().Be(countAdd);
2222

23-
Parallel.For(0, count, i => Dictionary.Remove(i));
24-
Dictionary.Count.Should().Be(0);
23+
const int countRemove = 900;
24+
Parallel.For(0, countRemove, i => Dictionary.Remove(i * 3));
25+
Dictionary.Count.Should().Be(countAdd - countRemove);
2526
}
2627
}

0 commit comments

Comments
 (0)