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 b99c4671 Ninja for CASSANDRA-18523: Update property generators for TxnId to respect the validated properties of Timestamp b99c4671 is described below commit b99c4671fa0b22bed7f5a37fc5acaa2d2579e5b2 Author: David Capwell <dcapw...@gmail.com> AuthorDate: Tue May 16 14:50:18 2023 -0700 Ninja for CASSANDRA-18523: Update property generators for TxnId to respect the validated properties of Timestamp --- accord-core/src/main/java/accord/primitives/Timestamp.java | 6 +++--- accord-core/src/test/java/accord/utils/AccordGens.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/accord-core/src/main/java/accord/primitives/Timestamp.java b/accord-core/src/main/java/accord/primitives/Timestamp.java index 9dc96f12..13bc2a55 100644 --- a/accord-core/src/main/java/accord/primitives/Timestamp.java +++ b/accord-core/src/main/java/accord/primitives/Timestamp.java @@ -75,9 +75,9 @@ public class Timestamp implements Comparable<Timestamp> Timestamp(long epoch, long hlc, int flags, Id node) { - Invariants.checkArgument(hlc >= 0); - Invariants.checkArgument(epoch <= MAX_EPOCH); - Invariants.checkArgument(flags <= MAX_FLAGS); + Invariants.checkArgument(hlc >= 0, "hlc must be positive or zero; given %d", hlc); + Invariants.checkArgument(epoch <= MAX_EPOCH, "epoch %d > MAX_EPOCH %d", epoch, MAX_EPOCH); + Invariants.checkArgument(flags <= MAX_FLAGS, "flags %d > MAX_FLAGS %d", flags, MAX_FLAGS); this.msb = epochMsb(epoch) | hlcMsb(hlc); this.lsb = hlcLsb(hlc) | flags; this.node = node; diff --git a/accord-core/src/test/java/accord/utils/AccordGens.java b/accord-core/src/test/java/accord/utils/AccordGens.java index 175a5e39..38f60384 100644 --- a/accord-core/src/test/java/accord/utils/AccordGens.java +++ b/accord-core/src/test/java/accord/utils/AccordGens.java @@ -47,7 +47,7 @@ public class AccordGens public static Gen<TxnId> txnIds() { - return txnIds(epochs()::nextLong, RandomSource::nextLong, RandomSource::nextInt); + return txnIds(epochs()::nextLong, rs -> rs.nextLong(0, Long.MAX_VALUE), RandomSource::nextInt); } public static Gen<TxnId> txnIds(Gen.LongGen epochs, Gen.LongGen hlcs, Gen.IntGen nodes) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org