//! # vanify::vanity tests use vanify::vanity; // Should return an error if the prefix constraints are invalid #[test] fn test_invalid_constraints_invalid_prefix() { let constraints = vanity::Constraints { prefix: "g".to_string(), suffix: "a".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return an error if the suffix constraints are invalid #[test] fn test_invalid_constraints_invalid_suffix() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "g".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return an error if the includes_all constraints are invalid #[test] fn test_invalid_constraints_invalid_includes_all() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "a".to_string(), includes_all: vec!["g".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return an error if the excludes_all constraints are invalid #[test] fn test_invalid_constraints_invalid_excludes_all() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "a".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["g".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return an error if the includes_any constraints are invalid #[test] fn test_invalid_constraints_invalid_includes_any() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "a".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["g".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return an error if the excludes_any constraints are invalid #[test] fn test_invalid_constraints_invalid_excludes_any() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "a".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["g".to_string()], }; assert_eq!(constraints.are_valid(), false); } // Should return true if all constraints are valid #[test] fn test_valid_constraints() { let constraints = vanity::Constraints { prefix: "a".to_string(), suffix: "a".to_string(), includes_all: vec!["b".to_string()], excludes_all: vec!["b".to_string()], includes_any: vec!["b".to_string()], excludes_any: vec!["b".to_string()], }; assert_eq!(constraints.are_valid(), true); }