From cfc5f720ce82775d7a79e4d719217eab4ff6298e Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 23 Feb 2022 02:39:47 +0530 Subject: [PATCH] feat: add tests for comparing HashMaps --- tests/integration_tests.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index cf16ff2..bc5b1de 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -6,8 +6,9 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use assay::assay; +use assay::{assay, assert_eq_sorted}; use std::{ + collections::HashMap, env, fs, future::Future, path::PathBuf, @@ -36,6 +37,15 @@ fn include() { assert!(fs::metadata("Cargo.toml")?.is_file()); } +#[assay(should_panic)] +fn hash_map_comparison() { + let map1: HashMap = (0..5).map(|n| (n.to_string(), n)).collect(); + let mut map2: HashMap = (0..5).map(|n| (n.to_string(), n)).collect(); + // Force the last item to be different + map2.insert("4".to_string(), 5); + assert_eq_sorted!(map1, map2); +} + #[assay] async fn async_func() { ReadyOnPoll.await;