mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-02 06:20:48 +01:00
Reduce slow algorithm test fixtures
This commit is contained in:
1 parent
856f865cf9
commit
e681044bf5
3 files changed
+7
-3
No files matched your search
@@ -186,10 +186,10 @@ fn a_hole_is_as_thick_as_it_is_through_not_along() {
|
||||
#[test]
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
fn thin_holes_are_filled_the_same_on_any_number_of_threads() {
|
||||
let (w, h) = (300, 200);
|
||||
let (w, h) = (150, 100);
|
||||
let img = busy(w, h, 3, 5);
|
||||
// A wavy line 6 px thick across the image.
|
||||
let hole: Vec<bool> = (0..w * h).map(|i| (((i % w) as f32 * 0.05).sin() * 30.0 + 100.0 - (i / w) as f32).abs() < 3.0).collect();
|
||||
let hole: Vec<bool> = (0..w * h).map(|i| (((i % w) as f32 * 0.05).sin() * 15.0 + 50.0 - (i / w) as f32).abs() < 3.0).collect();
|
||||
let px = roles(w, h, &hole);
|
||||
let run = |threads: usize| {
|
||||
let pool = rayon::ThreadPoolBuilder::new().num_threads(threads).build().unwrap();
|
||||
|
||||
@@ -367,7 +367,7 @@ fn multiband_matches_the_serial_code() {
|
||||
/// none and everything, pass through every split the images can have (#15652; it swept 47 budgets).
|
||||
#[test]
|
||||
fn multiband_batches_match_the_serial_code() {
|
||||
for (n, &(w, h)) in [(40usize, 30usize), (97, 61), (201, 129)].iter().enumerate() {
|
||||
for (n, &(w, h)) in [(40usize, 30usize), (97, 61)].iter().enumerate() {
|
||||
for ch in [1usize, 3] {
|
||||
let (imgs, wts) = rois(w, h, ch, n as u64 * 17 + ch as u64);
|
||||
for levels in [1usize, 3, 5] {
|
||||
|
||||
@@ -273,6 +273,10 @@ mod tests {
|
||||
let fmt = PixelFormat::new(mode, depth, true);
|
||||
for (w, h) in [(512, 512), (900, 240), (2400, 1200)] {
|
||||
for seed in [0, 3, 7, 18916] {
|
||||
// One seed exercises the large canvas; all seeds still run at both smaller sizes.
|
||||
if w == 2400 && seed != 0 {
|
||||
continue;
|
||||
}
|
||||
let px = render(fmt, w, h, seed, (BLACK, WHITE), None);
|
||||
let v: Vec<f32> = px.chunks_exact(fmt.channels()).map(|p| p[0]).collect();
|
||||
let n = v.len() as f32;
|
||||
|
||||
Reference in new issue
Block a user