MCPcopy Create free account
hub / github.com/cosdata/cosdata / test_field_value_conversion

Function test_field_value_conversion

src/grpc/metadata.rs:119–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117
118 #[test]
119 fn test_field_value_conversion() {
120 // Test integer conversion
121 let int_value = FieldValue::Int(42);
122 let proto_value: proto::FieldValue = int_value.clone().into();
123 let converted_back: FieldValue = proto_value.try_into().unwrap();
124 assert!(matches!(converted_back, FieldValue::Int(42)));
125
126 // Test string conversion
127 let string_value = FieldValue::String("test".to_string());
128 let proto_value: proto::FieldValue = string_value.clone().into();
129 let converted_back: FieldValue = proto_value.try_into().unwrap();
130 assert!(matches!(converted_back, FieldValue::String(s) if s == "test"));
131
132 // Test empty value
133 let empty_value = proto::FieldValue { value: None };
134 assert!(FieldValue::try_from(empty_value).is_err());
135 }
136
137 #[test]
138 fn test_metadata_field_conversion() {

Callers

nothing calls this directly

Calls 1

cloneMethod · 0.80

Tested by

no test coverage detected