From cbde0f1b880aabd71d0db273c3ce5d8bcdd4199d Mon Sep 17 00:00:00 2001 From: ngutech21 Date: Tue, 9 Jan 2024 14:33:13 +0100 Subject: [PATCH] chore: use pretty asserts in core --- moksha-core/src/amount.rs | 1 + moksha-core/src/dhke.rs | 1 + moksha-core/src/keyset.rs | 7 +++---- moksha-core/src/primitives.rs | 1 + moksha-core/src/proof.rs | 1 + 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/moksha-core/src/amount.rs b/moksha-core/src/amount.rs index 91102a28..32b87c18 100644 --- a/moksha-core/src/amount.rs +++ b/moksha-core/src/amount.rs @@ -75,6 +75,7 @@ pub fn generate_random_string() -> String { #[cfg(test)] mod tests { use crate::amount::SplitAmount; + use pretty_assertions::assert_eq; #[test] fn test_split_amount() -> anyhow::Result<()> { diff --git a/moksha-core/src/dhke.rs b/moksha-core/src/dhke.rs index e15bf300..eadb2639 100644 --- a/moksha-core/src/dhke.rs +++ b/moksha-core/src/dhke.rs @@ -146,6 +146,7 @@ pub fn public_key_from_hex(hex: &str) -> secp256k1::PublicKey { mod tests { use crate::dhke::{public_key_from_hex, Dhke}; use anyhow::Ok; + use pretty_assertions::assert_eq; fn hex_to_string(hex: &str) -> String { use hex::FromHex; diff --git a/moksha-core/src/keyset.rs b/moksha-core/src/keyset.rs index 4826202d..6d2ad07f 100644 --- a/moksha-core/src/keyset.rs +++ b/moksha-core/src/keyset.rs @@ -202,11 +202,10 @@ pub fn derive_pubkey(seed: &str) -> Result { #[cfg(test)] mod tests { - use std::collections::HashMap; - - use secp256k1::PublicKey; - use crate::keyset::{derive_pubkey, generate_hash}; + use pretty_assertions::assert_eq; + use secp256k1::PublicKey; + use std::collections::HashMap; fn public_key_from_hex(hex: &str) -> secp256k1::PublicKey { use hex::FromHex; diff --git a/moksha-core/src/primitives.rs b/moksha-core/src/primitives.rs index 5307d004..4124fea0 100644 --- a/moksha-core/src/primitives.rs +++ b/moksha-core/src/primitives.rs @@ -393,6 +393,7 @@ pub struct Nut12 { #[cfg(test)] mod tests { + use pretty_assertions::assert_eq; use crate::{ dhke::public_key_from_hex, diff --git a/moksha-core/src/proof.rs b/moksha-core/src/proof.rs index db614b44..a304a849 100644 --- a/moksha-core/src/proof.rs +++ b/moksha-core/src/proof.rs @@ -123,6 +123,7 @@ mod tests { proof::{Proof, Proofs}, token::TokenV3, }; + use pretty_assertions::assert_eq; #[test] fn test_proofs_for_amount_empty() -> anyhow::Result<()> {