Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
blckngm committed Dec 29, 2023
1 parent 28798f1 commit 9019c9b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/ci-tests/tests/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#![allow(clippy::cognitive_complexity)]

use std::{convert::TryFrom, iter::FromIterator};

use molecule::prelude::*;

use molecule_ci_tests::testset;
Expand Down Expand Up @@ -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));
}

0 comments on commit 9019c9b

Please sign in to comment.