You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2020/06/30 21:50:41 UTC
[lucenenet] 05/27: Lucene.Net.Tests.Util.TestIdentityHashSet: Use
non-aggressive comparison for J2N collections
This is an automated email from the ASF dual-hosted git repository.
nightowl888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucenenet.git
commit b76dc8150d63547991802da35dd7ed5698c7e8f9
Author: Shad Storhaug <sh...@shadstorhaug.com>
AuthorDate: Sun Jun 28 15:26:51 2020 +0700
Lucene.Net.Tests.Util.TestIdentityHashSet: Use non-aggressive comparison for J2N collections
---
src/Lucene.Net.Tests/Util/TestIdentityHashSet.cs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/Lucene.Net.Tests/Util/TestIdentityHashSet.cs b/src/Lucene.Net.Tests/Util/TestIdentityHashSet.cs
index b27c6f2..2bde589 100644
--- a/src/Lucene.Net.Tests/Util/TestIdentityHashSet.cs
+++ b/src/Lucene.Net.Tests/Util/TestIdentityHashSet.cs
@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using JCG = J2N.Collections.Generic;
using Assert = Lucene.Net.TestFramework.Assert;
+using System.Diagnostics.CodeAnalysis;
namespace Lucene.Net.Util
{
@@ -41,7 +42,7 @@ namespace Lucene.Net.Util
for (int i = 0; i < max; i++)
{
// some of these will be interned and some will not so there will be collisions.
- int? v = rnd.Next(threshold);
+ int v = rnd.Next(threshold);
bool e1 = jdk.Contains(v);
bool e2 = us.Contains(v);
@@ -53,12 +54,13 @@ namespace Lucene.Net.Util
}
ISet<object> collected = new JCG.HashSet<object>(IdentityEqualityComparer<object>.Default);
- foreach (object o in us)
+ foreach (var o in us)
{
collected.Add(o);
}
- assertEquals(collected, jdk);
+ // LUCENENET: We have 2 J2N hashsets, so no need to use aggressive mode
+ assertEquals(collected, jdk, aggressive: false);
}
}
}
\ No newline at end of file