This is an automated email from the ASF dual-hosted git repository.
zyxxoo pushed a commit to branch refactor/rust-rewrite-design
in repository https://gitbox.apache.org/repos/asf/hugegraph.git
The following commit(s) were added to refs/heads/refactor/rust-rewrite-design
by this push:
new d83d697a5 test(partition): kill range mismatch mutants
d83d697a5 is described below
commit d83d697a5e29d6cfac0361827e967cea8502e8ab
Author: vaughn <[email protected]>
AuthorDate: Sun Sep 13 17:00:37 2026 +0800
test(partition): kill range mismatch mutants
---
.../cargo-mutants-partition-final-20260913.log | 4 +++
tools/rust-partition-poc/src/lib.rs | 32 ++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git
a/docs/evidence/rust-rewrite/cargo-mutants-partition-final-20260913.log
b/docs/evidence/rust-rewrite/cargo-mutants-partition-final-20260913.log
new file mode 100644
index 000000000..f0a0b5dd7
--- /dev/null
+++ b/docs/evidence/rust-rewrite/cargo-mutants-partition-final-20260913.log
@@ -0,0 +1,4 @@
+Found 30 mutants to test
+ok Unmutated baseline in 0s build + 0s test
+MISSED src/main.rs:20:5: replace main with () in 0s build + 0s test
+30 mutants tested in 4s: 1 missed, 27 caught, 2 unviable
diff --git a/tools/rust-partition-poc/src/lib.rs
b/tools/rust-partition-poc/src/lib.rs
index 953a6dc9a..39203f719 100644
--- a/tools/rust-partition-poc/src/lib.rs
+++ b/tools/rust-partition-poc/src/lib.rs
@@ -76,6 +76,28 @@ mod tests {
assert!(validate(&base(), 20).is_ok());
}
#[test]
+ fn rejects_empty_partitions() {
+ assert_eq!(validate(&[], 20), Err("gap-at-start"));
+ }
+ #[test]
+ fn rejects_nonzero_first_start() {
+ let mut x = base();
+ x[0].start = 1;
+ assert_eq!(validate(&x, 20), Err("gap-at-start"));
+ }
+ #[test]
+ fn rejects_end_beyond_max() {
+ let mut x = base();
+ x[1].end = 21;
+ assert_eq!(validate(&x, 20), Err("invalid-range"));
+ }
+ #[test]
+ fn rejects_zero_length_range() {
+ let mut x = base();
+ x[0].end = 0;
+ assert_eq!(validate(&x, 20), Err("invalid-range"));
+ }
+ #[test]
fn catches_dropped_right_partition() {
let mut x = base();
x.pop();
@@ -113,6 +135,16 @@ mod tests {
);
}
#[test]
+ fn rejects_heartbeat_with_either_range_field_mismatch() {
+ let mut current = base()[0].clone();
+ let mut incoming = current.clone();
+ incoming.start = 1;
+ assert_eq!(apply_heartbeat(&mut current, incoming),
Err("range-mismatch"));
+ let mut incoming = current.clone();
+ incoming.end = 11;
+ assert_eq!(apply_heartbeat(&mut current, incoming),
Err("range-mismatch"));
+ }
+ #[test]
fn heartbeat_is_idempotent() {
let mut c = Partition {
start: 0,