Re-enable the VClock ordering tests

This commit is contained in:
Ben Kimock 2022-12-20 22:54:44 -05:00
parent d2e1c3738e
commit 749b2b077d

View File

@ -378,8 +378,9 @@ fn index_mut(&mut self, index: VectorIdx) -> &mut VTimestamp {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::{VClock, VectorIdx}; use super::{VClock, VTimestamp, VectorIdx};
use rustc_span::DUMMY_SP; use rustc_span::DUMMY_SP;
use std::cmp::Ordering;
#[test] #[test]
fn test_equal() { fn test_equal() {
@ -396,7 +397,6 @@ fn test_equal() {
assert_eq!(c1, c2); assert_eq!(c1, c2);
} }
/*
#[test] #[test]
fn test_partial_order() { fn test_partial_order() {
// Small test // Small test
@ -442,14 +442,14 @@ fn test_partial_order() {
); );
} }
fn from_slice(mut slice: &[VTimestamp]) -> VClock { fn from_slice(mut slice: &[u32]) -> VClock {
while let Some(0) = slice.last() { while let Some(0) = slice.last() {
slice = &slice[..slice.len() - 1] slice = &slice[..slice.len() - 1]
} }
VClock(smallvec::SmallVec::from_slice(slice)) VClock(slice.iter().copied().map(|time| VTimestamp { time, span: DUMMY_SP }).collect())
} }
fn assert_order(l: &[VTimestamp], r: &[VTimestamp], o: Option<Ordering>) { fn assert_order(l: &[u32], r: &[u32], o: Option<Ordering>) {
let l = from_slice(l); let l = from_slice(l);
let r = from_slice(r); let r = from_slice(r);
@ -505,5 +505,4 @@ fn assert_order(l: &[VTimestamp], r: &[VTimestamp], o: Option<Ordering>) {
"Invalid alt (>=):\n l: {l:?}\n r: {r:?}" "Invalid alt (>=):\n l: {l:?}\n r: {r:?}"
); );
} }
*/
} }