From 2984c3244cea8bb0604c686f5c5ab941fd5e4c71 Mon Sep 17 00:00:00 2001 From: soruh Date: Mon, 14 Aug 2023 17:05:43 +0200 Subject: [PATCH] fix Queue::last --- src/datastructures/queue.rs | 2 +- src/tests.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/datastructures/queue.rs b/src/datastructures/queue.rs index 09711f4..443a016 100644 --- a/src/datastructures/queue.rs +++ b/src/datastructures/queue.rs @@ -265,7 +265,7 @@ impl FilePointer res } - pub fn last(self, reader: &impl ReaderTrait, index: u64) -> Option { + pub fn last(self, reader: &impl ReaderTrait) -> Option { self.get(reader, self.length(reader) - 1) } diff --git a/src/tests.rs b/src/tests.rs index f8c246e..e3515eb 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -937,6 +937,10 @@ fn queue() { } } + if !root.is_empty(transaction) { + assert_eq!(root.last(transaction), Some(U64::from(i - 1))); + } + root });