Skip to content

Commit

Permalink
update with_parallel_unsafe test
Browse files Browse the repository at this point in the history
  • Loading branch information
s5suzuki committed Jan 25, 2025
1 parent fba771b commit 13a79e5
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions autd3/src/datagram/gain/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ mod tests {

#[test]
fn with_parallel_unsafe() -> anyhow::Result<()> {
let geometry = create_geometry(5);
let geometry = create_geometry(2);

let mut rng = rand::thread_rng();

Expand All @@ -344,16 +344,13 @@ mod tests {
let gain = Group::new(|dev| {
let dev_idx = dev.idx();
move |tr| match (dev_idx, tr.idx()) {
(0, 0..=99) => Some("null"),
(0, 100..=199) => Some("test"),
(1, 200..) => Some("test2"),
(3, _) => Some("test"),
_ => None,
}
})
.set("null", Null {}.into_boxed())?
.set("test", g1.into_boxed())?
.set("test2", g2.into_boxed())?;
.set("test", g1)?
.set("test2", g2)?;

let mut g = gain.init_full(&geometry, None, true)?;
let drives = geometry
Expand All @@ -366,7 +363,7 @@ mod tests {
)
})
.collect::<HashMap<_, _>>();
assert_eq!(5, drives.len());
assert_eq!(2, drives.len());
drives[&0].iter().enumerate().for_each(|(i, &d)| match i {
i if i <= 99 => {
assert_eq!(Drive::NULL, d);
Expand All @@ -386,15 +383,6 @@ mod tests {
assert_eq!(d2, d);
}
});
drives[&2].iter().for_each(|&d| {
assert_eq!(Drive::NULL, d);
});
drives[&3].iter().for_each(|&d| {
assert_eq!(d1, d);
});
drives[&4].iter().for_each(|&d| {
assert_eq!(Drive::NULL, d);
});

Ok(())
}
Expand Down

0 comments on commit 13a79e5

Please sign in to comment.