feat: core domain types and Filter predicate

This commit is contained in:
2026-05-18 16:16:08 +02:00
parent 70be6449db
commit 30799ddb0b
2 changed files with 163 additions and 1 deletions
+20
View File
@@ -0,0 +1,20 @@
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);
}