This is an automated email from the ASF dual-hosted git repository.

dcapwell pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/cassandra-accord.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c0a741bd Accord range based tests have their inclusive field flipped 
(#286)
c0a741bd is described below

commit c0a741bdf83cba2dc2db116c37ddb44120e0289a
Author: Alan Wang <[email protected]>
AuthorDate: Tue Aug 11 15:36:57 2026 -0700

    Accord range based tests have their inclusive field flipped (#286)
    
    patch by Alan Wang; reviewed by Ariel Weisberg, David Capwell for 
CASSANDRA-21566
---
 .../java/accord/primitives/AbstractRangesTest.java |  2 +-
 .../test/java/accord/primitives/KeyDepsTest.java   | 30 +++-------------------
 2 files changed, 5 insertions(+), 27 deletions(-)

diff --git 
a/accord-core/src/test/java/accord/primitives/AbstractRangesTest.java 
b/accord-core/src/test/java/accord/primitives/AbstractRangesTest.java
index c10ff04b..9485736e 100644
--- a/accord-core/src/test/java/accord/primitives/AbstractRangesTest.java
+++ b/accord-core/src/test/java/accord/primitives/AbstractRangesTest.java
@@ -47,7 +47,7 @@ class AbstractRangesTest
                 range("second", 20, 30),
                 range("third", 30, 40)
         );
-        assertThat(ranges.toString()).isEqualTo("[first:[[0,10),[10,20)], 
second:[[20,30)], third:[[30,40)]]");
+        assertThat(ranges.toString()).isEqualTo("[first:[(0,10],(10,20]], 
second:[(20,30]], third:[(30,40]]]");
     }
 
     @Test
diff --git a/accord-core/src/test/java/accord/primitives/KeyDepsTest.java 
b/accord-core/src/test/java/accord/primitives/KeyDepsTest.java
index 3e25db32..c7b3339f 100644
--- a/accord-core/src/test/java/accord/primitives/KeyDepsTest.java
+++ b/accord-core/src/test/java/accord/primitives/KeyDepsTest.java
@@ -196,10 +196,11 @@ public class KeyDepsTest
     }
 
     @Test
-    public void testForEachOnUniqueEndInclusive()
+    public void testForEachOnUnique()
     {
         qt().forAll(Gen.of(Deps::generate).filter(d -> d.test.keys().size() >= 
2)).check(deps -> {
             RoutingKeys keys = deps.test.keys();
+            // By default, all ranges are start exclusive and end inclusive 
(start, end]
             RoutingKey start = keys.get(0);
             RoutingKey end = keys.get(keys.size() - 1);
             if (start.equals(end))
@@ -221,37 +222,14 @@ public class KeyDepsTest
         });
     }
 
-    @Test
-    public void testForEachOnUniqueStartInclusive()
-    {
-        qt().forAll(Gen.of(Deps::generate).filter(d -> d.test.keys().size() >= 
2)).check(deps -> {
-            RoutingKeys keys = deps.test.keys();
-            RoutingKey start = keys.get(0);
-            RoutingKey end = keys.get(keys.size() - 1);
-
-            TreeSet<TxnId> seen = new TreeSet<>();
-            
deps.test.forEachUniqueTxnId(Ranges.of(Range.of(start.toUnseekable(), 
end.toUnseekable())), txnId -> {
-                if (!seen.add(txnId))
-                    throw new AssertionError("Seen " + txnId + " multiple 
times");
-            });
-            Set<TxnId> notExpected = deps.canonical.get(end);
-            for (int i = 0; i < keys.size() - 1; i++)
-            {
-                Set<TxnId> ids = deps.canonical.get(keys.get(i));
-                notExpected = Sets.difference(notExpected, ids);
-            }
-            TreeSet<TxnId> expected = new 
TreeSet<>(Sets.difference(deps.invertCanonical().keySet(), notExpected));
-            Assertions.assertEquals(expected, seen);
-        });
-    }
-
     @Test
     public void testForEachOnUniqueNoMatch()
     {
         qt().forAll(Gen.of(Deps::generate).filter(d -> d.test.keys().size() >= 
2)).check(deps -> {
             RoutingKeys keys = deps.test.keys();
+            // By default, all ranges are start exclusive and end inclusive 
(start, end]
             Hash start = IntHashKey.forHash(Integer.MIN_VALUE);
-            RoutingKey end = keys.get(0);
+            Hash end = IntHashKey.forHash(((IntHashKey) keys.get(0)).hash - 1);
 
             TreeSet<TxnId> seen = new TreeSet<>();
             
deps.test.forEachUniqueTxnId(Ranges.of(Range.of(start.toUnseekable(), 
end.toUnseekable())), txnId -> {


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to