#[derive(Debug, VariantEq)] enum GenericColor { Red(A), Blue(A), } #[test] fn eq_generic_variants() { assert_eq!(GenericColor::Red(true), GenericColor::Red(true)); assert_eq!(GenericColor::Red(true), GenericColor::Red(false)); assert_eq!(GenericColor::Blue(1), GenericColor::Blue(1)); assert_eq!(GenericColor::Blue(1), GenericColor::Blue(2)); } #[test] fn ne_generic_variants() { assert_ne!(GenericColor::Red(1), GenericColor::Blue(1)); } #[derive(Debug, VariantEq)] enum GenericColorExplicit { Red(A), Blue(B), } #[test] fn eq_generic_variants_explicit() { assert_eq!( GenericColorExplicit::Red::(true), GenericColorExplicit::Red::(true) ); assert_eq!( GenericColorExplicit::Red::(true), GenericColorExplicit::Red::(false) ); assert_eq!( GenericColorExplicit::Blue::(1), GenericColorExplicit::Blue::(1) ); assert_eq!( GenericColorExplicit::Blue::(1), GenericColorExplicit::Blue::(2) ); } #[test] fn ne_generic_variants_explicit() { assert_ne!( GenericColorExplicit::Red::(1), GenericColorExplicit::Blue::(1) ); }