use libremetaverse_structured_data::{OSD, OSDParser};
use libremetaverse_types::{AssetType, Color4, InventoryType, PrimFlags, Utils};

#[test]
fn catalog_values_and_inert_layouts_are_real() {
    assert_eq!(AssetType::Material as i8, 57);
    assert_eq!(InventoryType::CATEGORY.0, 8);
    assert_eq!(InventoryType::FOLDER.0, 8);
    assert_eq!(PrimFlags::PHYSICS.0, 1);
    assert_eq!(Utils::PI.to_bits(), 0x4049_0fdb);

    let color = Color4 {
        r: 0.25,
        g: 0.5,
        b: 0.75,
        a: 1.0,
    };
    assert_eq!((color.r, color.g, color.b, color.a), (0.25, 0.5, 0.75, 1.0));

    let value = OSD::Binary(vec![1, 2, 3]);
    assert!(matches!(value, OSD::Binary(bytes) if bytes == [1, 2, 3]));
}

#[test]
fn serializer_entry_point_returns_its_exact_member_id() {
    let Err(error) = OSDParser::deserialize_with_bytes(Vec::new()) else {
        panic!("failure-only serializer unexpectedly returned a value");
    };
    assert_eq!(
        error.csharp_member(),
        Some("M:LibreMetaverse.StructuredData.OSDParser.Deserialize(System.Byte[])")
    );
}
