// Copyright (c) 2026 Kirky.X
//
// Licensed under the MIT License
// See LICENSE file in the project root for full license information.

//! 属性记录功能单元测试

#[cfg(test)]
mod tests {
    use dbnexus::tracing::{attributes::AttributeValue, context::TracingContext};

    #[test]
    fn test_set_string_attribute() {
        let mut context = TracingContext::new("test_span");
        context.set_attribute("key", AttributeValue::String("value".to_string()));
        // 验证属性已设置
        // 注意：由于 span 内部状态不可访问，这里主要验证方法调用不报错
        // 实际验证通过集成测试完成
    }

    #[test]
    fn test_set_numeric_attribute() {
        let mut context = TracingContext::new("test_span");
        context.set_attribute("count", AttributeValue::I64(42));
        // 验证属性已设置
    }

    #[test]
    fn test_set_float_attribute() {
        let mut context = TracingContext::new("test_span");
        context.set_attribute("ratio", AttributeValue::F64(3.14));
        // 验证属性已设置
    }

    #[test]
    fn test_set_bool_attribute() {
        let mut context = TracingContext::new("test_span");
        context.set_attribute("enabled", AttributeValue::Bool(true));
        // 验证属性已设置
    }

    #[test]
    fn test_set_attributes_multiple() {
        let mut context = TracingContext::new("test_span");
        let attributes = vec![
            ("name".to_string(), AttributeValue::String("test".to_string())),
            ("count".to_string(), AttributeValue::I64(10)),
            ("active".to_string(), AttributeValue::Bool(true)),
        ];
        context.set_attributes(attributes);
        // 验证多个属性已设置
    }
}
