commit e84cda1b38cdcef2cad084bef0b350d0c201e65d
parent 37d061c146da01b18f4600dc6947aae7e844ed73
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Thu, 7 Nov 2024 04:59:05 +0200
Add a test for the manual word generator.
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/src/main.rs b/src/main.rs
@@ -343,6 +343,16 @@ mod tests {
assert_eq!("abacus", read_single_word(&mut reader, &wordlist).unwrap());
}
+ #[test]
+ fn test_read_words_from_die_casting() {
+ let wordlist = Wordlist::default().get_list().to_vec();
+ let input = &b"11111\n66665\n"[..];
+ let mut reader = BufReader::with_capacity(input.len(), input).bytes();
+ let mut words_iter = ReadWordDieCasts::new(&mut reader, &wordlist);
+ assert_eq!("abacus", words_iter.next().unwrap());
+ assert_eq!("zoology", words_iter.next().unwrap());
+ }
+
// #[test]
// fn test_read_words_from_rolls() {
// let wordlist = Wordlist::default().get_list().to_vec();