Files
alpha-id/tests/model_tests.rs
T

21 lines
665 B
Rust

use alpha_id::model::{Filter, Tags, Mode};
#[test]
fn filter_billable_only_rejects_non_primary() {
let tags = Tags { billable: false, valid: true, chapter: "I".into(), exotic: false };
let f = Filter { billable_only: true, valid_only: false, chapters: None, exclude_exotic: false };
assert!(!f.accepts(&tags));
}
#[test]
fn filter_default_accepts_everything() {
let tags = Tags { billable: false, valid: false, chapter: "II".into(), exotic: true };
assert!(Filter::default().accepts(&tags));
}
#[test]
fn mode_parses_from_str() {
assert_eq!("a".parse::<Mode>().unwrap(), Mode::A);
assert_eq!("c".parse::<Mode>().unwrap(), Mode::C);
}