Skip to content

Commit

Permalink
Make tests pass under miri in a reasonable time
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJoDeveloping committed Aug 28, 2024
1 parent e8763d4 commit c40400e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/map/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ pub fn key(i: usize) -> std::vec::Vec<u8> {
}

/// Only used for testing
#[cfg(feature = "std")]
#[cfg(all(feature = "std", not(miri)))]
pub fn big_value(i: usize) -> std::vec::Vec<u8> {
format!("{:01048576}", i).into_bytes()
}
#[cfg(all(feature = "std", miri))]
pub fn big_value(i: usize) -> std::vec::Vec<u8> {
format!("{:01024}", i).into_bytes()
}

/// Only used for testing
pub fn new_value(i: usize) -> std::vec::Vec<u8> {
Expand Down Expand Up @@ -1120,7 +1124,10 @@ fn test_lt_map_anon_unify() {
}

fn test_basic_large_testcases_in(l: Arc<SkipMap>) {
#[cfg(not(any(miri)))]
let n = 1000;
#[cfg(any(miri))]
let n = 200; //takes about 30s on miri, that's large enough

for i in 0..n {
l.get_or_insert(0, &key(i), &new_value(i)).unwrap();
Expand Down

0 comments on commit c40400e

Please sign in to comment.