// SPDX-License-Identifier: MIT OR Apache-2.0
// Copyright (c) 2025 lacklustr@protonmail.com https://github.com/eadf

use remesh::prelude::*;

#[test]
fn test_smooth_1() -> Result<(), RemeshError> {
    let vertices = vec![
        [-0.5, -0.5, -0.5],
        [-0.5, -0.5, 0.5],
        [-0.5, 0.5, -0.5],
        [-0.5, 0.5, 0.5],
        [0.5, -0.5, -0.5],
        [0.5, -0.5, 0.5],
        [0.5, 0.5, -0.5],
        [0.5, 0.5, 0.5],
        [-0.21361782, 0.5, 0.0],
    ];
    let indices = vec![
        3, 8, 2, 2, 0, 1, 1, 7, 3, 5, 6, 7, 6, 8, 7, 3, 2, 1, 5, 7, 1, 4, 5, 0, 6, 0, 2, 1, 0, 5,
        4, 0, 6, 4, 6, 5, 3, 7, 8, 6, 2, 8,
    ];
    let (result_vertices, result_indices) = IsotropicRemesh::<f32, _>::new(&vertices, &indices)?
        .with_target_edge_length(0.5_f32)?
        .with_split_edges(SplitStrategy::Disabled)?
        .with_collapse_edges(CollapseStrategy::Disabled)?
        .with_default_smooth_weight()?
        .with_flip_edges(FlipStrategy::Disabled)?
        .run(1)?;

    assert_eq!(result_vertices.len(), 9, "result_vertices.len() mismatch");
    assert_eq!(result_indices.len(), 42, "result_indices.len() mismatch");
    Ok(())
}
