mirror of
https://github.com/ankitects/anki.git
synced 2026-01-11 13:03:55 -05:00
Remove test
The test wasn't much helpful.
This commit is contained in:
parent
c924df0d53
commit
94b7ac03d6
1 changed files with 0 additions and 46 deletions
|
|
@ -561,49 +561,3 @@ mod test {
|
|||
col.set_current_deck(child.id).unwrap();
|
||||
assert_eq!(col.card_queue_len(), 0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn intraday_learning_prioritizes_previously_attempted() -> Result<()> {
|
||||
let mut col = Collection::new();
|
||||
|
||||
// create two notes with one card each
|
||||
let nt = col.get_notetype_by_name("Basic")?.unwrap();
|
||||
let mut n1 = nt.new_note();
|
||||
n1.set_field(0, "one")?;
|
||||
col.add_note(&mut n1, DeckId(1))?;
|
||||
let mut n2 = nt.new_note();
|
||||
n2.set_field(0, "two")?;
|
||||
col.add_note(&mut n2, DeckId(1))?;
|
||||
|
||||
// fetch their cards and make them intraday learning cards
|
||||
let mut c1 = col.storage.get_card_by_ordinal(n1.id, 0)?.unwrap();
|
||||
let mut c2 = col.storage.get_card_by_ordinal(n2.id, 0)?.unwrap();
|
||||
|
||||
c1.queue = CardQueue::Learn;
|
||||
c2.queue = CardQueue::Learn;
|
||||
|
||||
// c1: never attempted, due earlier (0)
|
||||
c1.due = 0;
|
||||
c1.reps = 0;
|
||||
// c2: previously attempted, due later (600)
|
||||
c2.due = 600;
|
||||
c2.reps = 1;
|
||||
|
||||
let id1 = c1.id;
|
||||
let id2 = c2.id;
|
||||
|
||||
col.update_cards_maybe_undoable(vec![c1, c2], false)?;
|
||||
|
||||
// build queues and inspect intraday learning order
|
||||
let queues = col.build_queues(DeckId(1))?;
|
||||
let ids: Vec<_> = queues.intraday_learning.iter().map(|e| e.id).collect();
|
||||
|
||||
// ensure the previously attempted card appears before the never-attempted one
|
||||
assert!(
|
||||
ids.iter().position(|&id| id == id2).unwrap()
|
||||
< ids.iter().position(|&id| id == id1).unwrap()
|
||||
);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue