// Exact Rust translation of LibreMetaverse.Tests/RLV/RlvCommonTests.cs.
// Source SHA-256: 1e3e097f189cb39e9204a82d881be38847d696870debe7d62e3ddf13b9951a6f

use libremetaverse_rlv::{RlvAttachmentPoint, RlvCommon};

#[allow(clippy::option_option)]
fn point(item_name: &str) -> (bool, Option<Option<RlvAttachmentPoint>>) {
    let mut actual = None;
    let found = RlvCommon::try_get_attachment_point_from_item_name(item_name.into(), &mut actual);
    (found, actual)
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:7da68a0c44d86b61 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_spine() {
    assert_eq!(
        point("(spine)"),
        (true, Some(Some(RlvAttachmentPoint::Spine)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:d4dfd612ab268dc7 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_repeated_spine() {
    assert_eq!(
        point("(spine)(spine)"),
        (true, Some(Some(RlvAttachmentPoint::Spine)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:58d5bce9d704814b 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_uses_last_known_tag() {
    assert_eq!(
        point("My (mouth) item (spine) has a lot of tags"),
        (true, Some(Some(RlvAttachmentPoint::Spine)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:7c453569c08c0a0f 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_ignores_unknown_tag() {
    assert_eq!(
        point("My item (l upper leg) and some random unknown tag (unknown)"),
        (true, Some(Some(RlvAttachmentPoint::LeftUpperLeg)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:ace2eedabcda99e6 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_avatar_center() {
    assert_eq!(
        point("Central item (avatar center)"),
        (true, Some(Some(RlvAttachmentPoint::AvatarCenter)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName::case:1a967cd76f5fa058 2e932256b5a230d8c8ce814c1c919e4f1ae346f6f7263682661d1b10d4a05a17 translated
#[test]
fn attachment_point_root_alias() {
    assert_eq!(
        point("Central item (root)"),
        (true, Some(Some(RlvAttachmentPoint::AvatarCenter)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName_CaseSensitive::case:f6b796736de6a5d8 cca41435176820c1b26287db1ea697128e5f093f2d91357081c469ba0b90e26c translated
#[test]
fn attachment_point_uppercase_spine() {
    assert_eq!(
        point("(SPINE)"),
        (true, Some(Some(RlvAttachmentPoint::Spine)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName_CaseSensitive::case:787d37133953ab32 cca41435176820c1b26287db1ea697128e5f093f2d91357081c469ba0b90e26c translated
#[test]
fn attachment_point_titlecase_spine() {
    assert_eq!(
        point("(Spine)"),
        (true, Some(Some(RlvAttachmentPoint::Spine)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName_CaseSensitive::case:d2056032186a0a97 cca41435176820c1b26287db1ea697128e5f093f2d91357081c469ba0b90e26c translated
#[test]
fn attachment_point_titlecase_avatar_center() {
    assert_eq!(
        point("Central item (Avatar center)"),
        (true, Some(Some(RlvAttachmentPoint::AvatarCenter)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemName_CaseSensitive::case:c1f038c1236211aa cca41435176820c1b26287db1ea697128e5f093f2d91357081c469ba0b90e26c translated
#[test]
fn attachment_point_lowercase_left_upper_leg() {
    assert_eq!(
        point("Another item (l upper leg)"),
        (true, Some(Some(RlvAttachmentPoint::LeftUpperLeg)))
    );
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemNameInvalid::case:564c3e282f3b402f c20289eb110772fb51f82d59b595ebb429f15d6d2a8f93daa8672702dd85ce34 translated
#[test]
fn attachment_point_rejects_unknown_tags() {
    assert_eq!(point("(unknown)(hand tag)(spine tag)"), (false, None));
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemNameInvalid::case:1d03935868fa6124 c20289eb110772fb51f82d59b595ebb429f15d6d2a8f93daa8672702dd85ce34 translated
#[test]
fn attachment_point_rejects_untagged_name() {
    assert_eq!(point("Hat"), (false, None));
}

// parity-case: LibreMetaverse.Tests/RLV/RlvCommonTests.cs::RlvCommonTests.TryGetRlvAttachmentPointFromItemNameInvalid::case:12ae32cb1ec02d01 c20289eb110772fb51f82d59b595ebb429f15d6d2a8f93daa8672702dd85ce34 translated
#[test]
fn attachment_point_rejects_empty_name() {
    assert_eq!(point(""), (false, None));
}
