diff --git a/examples/ci-tests/tests/build.rs b/examples/ci-tests/tests/build.rs index d09c1f8..a42d48c 100644 --- a/examples/ci-tests/tests/build.rs +++ b/examples/ci-tests/tests/build.rs @@ -1,5 +1,7 @@ #![allow(clippy::cognitive_complexity)] +use std::{convert::TryFrom, iter::FromIterator}; + use molecule::prelude::*; use molecule_ci_tests::testset; @@ -43,3 +45,19 @@ macro_rules! verify_build_empty { fn build_empty_can_verify() { testset!(all, verify_build_empty); } + +#[test] +fn test_conversion() { + use molecule_ci_tests::types::*; + + assert_eq!( + Byte11::try_from(&[3; 11][..]).unwrap().as_bytes(), + &[3; 11][..], + ); + assert_eq!( + u32::from_le_bytes(Byte4::from(3u32.to_le_bytes()).into()), + 3u32, + ); + let _ = BytesVecOpt::from(BytesVec::from_iter([Bytes::from_iter([3, 4])])); + let _ = UnionA::from(Byte::from(3u8)); +}