steal other pr's test

This commit is contained in:
Luc Mcgrady 2025-08-04 19:41:46 +01:00
parent ea29078ac2
commit 02f31791ac
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C

View file

@ -31,3 +31,21 @@ impl Collection {
Ok(studied_today(today.cards, today.seconds as f32, &self.tr)) Ok(studied_today(today.cards, today.seconds as f32, &self.tr))
} }
} }
#[cfg(test)]
mod test {
use anki_i18n::I18n;
use super::studied_today;
#[test]
fn today() {
let tr = I18n::template_only();
assert_eq!(
&studied_today(3, 13.0, &tr).replace('\n', " "),
"Studied 3 cards in 13 seconds today (4.33s/card)"
);
assert_eq!(
&studied_today(300, 5400.0, &tr).replace('\n', " "),
"Studied 300 cards in 90 minutes today (18s/card)"
);
}
}