use libremetaverse::Primitive;
use libremetaverse::rendering::{DetailLevel, SimpleMesh};
use libremetaverse_prim_mesher::PrimMesh;
use libremetaverse_rendering_mesh_foundry::MeshFoundry;
use libremetaverse_rendering_simple::SimpleRenderer;

#[test]
fn mesh_and_renderer_calls_compile_with_typed_elements() {
    let _: fn(i32, f32, f32, f32, i32) -> Result<PrimMesh, libremetaverse_prim_mesher::Error> =
        PrimMesh::new;
    let _: fn(
        &SimpleRenderer,
        Primitive,
        DetailLevel,
    ) -> Result<SimpleMesh, libremetaverse_rendering_simple::Error> =
        SimpleRenderer::generate_simple_mesh;
    let _: fn(
        &MeshFoundry,
        Primitive,
        DetailLevel,
    ) -> Result<Option<SimpleMesh>, libremetaverse_rendering_mesh_foundry::Error> =
        MeshFoundry::generate_simple_mesh;
}

#[test]
fn owned_constructors_fail_with_exact_member_ids() {
    let Err(prim_error) = PrimMesh::new(4, 0.0, 1.0, 0.0, 4) else {
        panic!("failure-only PrimMesh constructor unexpectedly returned a value");
    };
    assert_eq!(
        prim_error.csharp_member(),
        Some(
            "M:LibreMetaverse.PrimMesher.PrimMesh.#ctor(System.Int32,System.Single,System.Single,System.Single,System.Int32)"
        )
    );

    let Err(renderer_error) = SimpleRenderer::new() else {
        panic!("failure-only renderer constructor unexpectedly returned a value");
    };
    assert_eq!(
        renderer_error.csharp_member(),
        Some("M:LibreMetaverse.Rendering.SimpleRenderer.#ctor")
    );
}
