mirror of
https://github.com/NotAShelf/stash.git
synced 2026-04-13 06:23:47 +00:00
db/nonblocking: add test-only imports for the Fnv1aHasher
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I66effd259c6654bd4efac2f4e6bc4e176a6a6964
This commit is contained in:
parent
d643376cd7
commit
77ac70f0d3
1 changed files with 3 additions and 2 deletions
|
|
@ -146,11 +146,12 @@ impl Clone for AsyncClipboardDb {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use std::collections::HashSet;
|
use std::{collections::HashSet, hash::Hasher};
|
||||||
|
|
||||||
use tempfile::tempdir;
|
use tempfile::tempdir;
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
use crate::hash::Fnv1aHasher;
|
||||||
|
|
||||||
fn setup_test_db() -> (AsyncClipboardDb, tempfile::TempDir) {
|
fn setup_test_db() -> (AsyncClipboardDb, tempfile::TempDir) {
|
||||||
let temp_dir = tempdir().expect("Failed to create temp dir");
|
let temp_dir = tempdir().expect("Failed to create temp dir");
|
||||||
|
|
@ -198,7 +199,7 @@ mod tests {
|
||||||
.expect("Hash should exist");
|
.expect("Hash should exist");
|
||||||
|
|
||||||
// Calculate expected hash
|
// Calculate expected hash
|
||||||
let mut hasher = crate::db::Fnv1aHasher::new();
|
let mut hasher = Fnv1aHasher::new();
|
||||||
hasher.write(data);
|
hasher.write(data);
|
||||||
let expected_hash = hasher.finish() as i64;
|
let expected_hash = hasher.finish() as i64;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue