#![allow(nonstandard_style)] use ::eset::*; use num_enum::{TryFromPrimitive, IntoPrimitive}; use strum::{Display,EnumString}; #[derive(Debug, Clone, Copy, PartialEq, Eq, IntoPrimitive, TryFromPrimitive, Display, EnumString)] #[repr(u8)] enum Alphabet { A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, } derive_eset!(Alphabet); impl ReprEnum for Alphabet { type Repr = u8; type FlagsRepr = u64; } use Alphabet::*; #[test] pub fn iteration_test() { let dna = eset!(A|T|C|G); let mut iter = dna.into_iter(); assert_eq!(iter.next(), Some(A)); assert_eq!(iter.next(), Some(C)); assert_eq!(iter.next(), Some(G)); assert_eq!(iter.next(), Some(T)); assert_eq!(iter.next(), None); } #[test] pub fn collect_test() { let dna = eset!(A|T|C|G); let dna2 = dna.into_iter().collect(); assert!(dna == dna2); let dna3 = ESet::new_flags(&[A, T, C, G]); assert!(dna == dna3); }