fix: More broken tests

This commit is contained in:
Emilia Allison 2024-08-11 11:51:19 -04:00
parent b25d1eb0c6
commit 9aad876a31
Signed by: emilia
GPG Key ID: 7A3F8997BFE894E0
1 changed files with 9 additions and 11 deletions

View File

@ -566,35 +566,33 @@ mod tests {
} }
#[test] #[test]
#[wasm_bindgen_test]
fn test_pooling_transfer() { fn test_pooling_transfer() {
use std::collections::HashSet;
let transfer1 = TransferRegion { let transfer1 = TransferRegion {
source_plate: Plate::new(PlateType::Source, PlateFormat::W384), source_plate: Plate::new(PlateType::Source, PlateFormat::W384),
dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384), dest_plate: Plate::new(PlateType::Destination, PlateFormat::W384),
source_region: Region::Rect((1, 4), (3, 7)), source_region: Region::Rect(Well{ row: 1, col: 4}, Well{ row: 3, col: 7}),
dest_region: Region::Point((1, 9)), dest_region: Region::Point(Well{ row: 1, col: 9}),
interleave_source: (1, 1), interleave_source: (1, 1),
interleave_dest: (0, 2), interleave_dest: (0, 2),
}; };
//let transfer1_source = transfer1.get_source_wells(); //let transfer1_source = transfer1.get_source_wells();
let mut transfer1_dest = transfer1.get_destination_wells(); let transfer1_dest: HashSet<Well> = transfer1.get_destination_wells().into_iter().collect();
transfer1_dest.sort();
transfer1_dest.dedup(); // Makes our check easier, otherwise we have repeated wells
let transfer1_map = transfer1.calculate_map(); let transfer1_map = transfer1.calculate_map();
// Skipping source check---it's just 12 wells. // Skipping source check---it's just 12 wells.
assert_eq!( assert_eq!(
transfer1_dest, transfer1_dest,
vec![(1, 9), (1, 11), (1, 13), (1, 15)], vec![Well{ row: 1, col: 9}, Well{ row: 1, col: 11}, Well{ row: 1, col: 13}, Well{ row: 1, col: 15}].into_iter().collect(),
"Failed type pool 1 dest" "Failed type pool 1 dest"
); );
assert_eq!( assert_eq!(
transfer1_map((2, 6)), transfer1_map(Well{ row: 2, col: 6}),
Some(vec![(1, 13)]), Some(vec![Well{ row: 1, col: 13}]),
"Failed type pool 1 map 1" "Failed type pool 1 map 1"
); );
assert_eq!( assert_eq!(
transfer1_map((3, 7)), transfer1_map(Well{ row: 3, col: 7}),
Some(vec![(1, 15)]), Some(vec![Well{ row: 1, col: 15}]),
"Failed type pool 1 map 2" "Failed type pool 1 map 2"
); );
} }