Skip to content

Commit 62acc15

Browse files
committed
value_tests: add compute_hash util function
1 parent 9ddaedf commit 62acc15

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scylla-cql/src/frame/value_tests.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ fn serialized_only_new<T: SerializeCql>(val: T, typ: ColumnType) -> Vec<u8> {
4444
result
4545
}
4646

47+
fn compute_hash<T: Hash>(x: &T) -> u64 {
48+
let mut hasher = DefaultHasher::new();
49+
x.hash(&mut hasher);
50+
hasher.finish()
51+
}
52+
4753
#[test]
4854
fn boolean_serialization() {
4955
assert_eq!(serialized(true, ColumnType::Boolean), vec![0, 0, 0, 1, 1]);
@@ -550,12 +556,6 @@ fn timeuuid_ordering_properties() {
550556
assert_eq!(std::cmp::Ordering::Equal, cmp_res);
551557

552558
assert_eq!(x, y);
553-
554-
let compute_hash = |x: &CqlTimeuuid| {
555-
let mut hasher = DefaultHasher::new();
556-
x.hash(&mut hasher);
557-
hasher.finish()
558-
};
559559
assert_eq!(compute_hash(&x), compute_hash(&y));
560560
}
561561

0 commit comments

Comments
 (0)