Skip to content

Commit

Permalink
chore: added test
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Dec 10, 2024
1 parent a88f53c commit 6262a43
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/agent/generator/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,4 +291,28 @@ mod tests {
let history = ChatHistory::create(conv, ConversationWindow::Summary);
assert_eq!(history.history, expected);
}

#[test]
fn test_last_n_strategy() {
let conv = vec![
Message::Agent("test1".to_string(), None),
Message::Feedback("feedback1".to_string(), None),
Message::Agent("test2".to_string(), None),
Message::Feedback("feedback2".to_string(), None),
Message::Agent("test3".to_string(), None),
Message::Feedback("feedback3".to_string(), None),
Message::Agent("test4".to_string(), None),
Message::Feedback("feedback4".to_string(), None),
];

let expected = vec![
Message::Agent("test3".to_string(), None),
Message::Feedback("feedback3".to_string(), None),
Message::Agent("test4".to_string(), None),
Message::Feedback("feedback4".to_string(), None),
];

let history = ChatHistory::create(conv, ConversationWindow::LastN(4));
assert_eq!(history.history, expected);
}
}

0 comments on commit 6262a43

Please sign in to comment.