#![cfg(feature = "std")]
use stellar_xdr::{Error, StringM};
use std::str::FromStr;
#[test]
fn stringm_from_str_at_max() {
let result = StringM::<3>::from_str("abc");
assert!(result.is_ok());
assert_eq!(result.unwrap().as_vec(), b"abc");
}
#[test]
fn stringm_from_str_within_max() {
let result = StringM::<3>::from_str("ab");
assert!(result.is_ok());
assert_eq!(result.unwrap().as_vec(), b"ab");
}
#[test]
fn stringm_from_str_exceeding_max() {
let result = StringM::<3>::from_str("abcd");
assert_eq!(result, Err(Error::LengthExceedsMax));
}
#[test]
fn stringm_from_str_empty() {
let result = StringM::<3>::from_str("");
assert!(result.is_ok());
assert_eq!(result.unwrap().as_vec(), b"");
}