commit 25bcf51d5d2d059cf180c0b9fccfd26f9c97ac14
parent ad78d15d5e27b0eedb39e61e15e775495486815b
Author: Yuval Langer <yuval.langer@gmail.com>
Date: Tue, 16 Jun 2015 23:20:47 +0300
Oops, forgot tests.rs
Diffstat:
1 file changed, 31 insertions(+), 0 deletions(-)
diff --git a/src/tests.rs b/src/tests.rs
@@ -0,0 +1,31 @@
+extern crate rand;
+
+use rand::{Rng, SeedableRng, StdRng};
+
+use diceware::{ReinholdWord, BealeWord};
+
+fn make_beale_word() -> BealeWord {
+ let seed: &[_] = &[1, 2, 3, 4];
+ let mut rng: StdRng = SeedableRng::from_seed(seed);
+ let word = rng.gen();
+ word
+}
+
+fn make_reinhold_word() -> ReinholdWord {
+ let seed: &[_] = &[1, 2, 3, 4];
+ let mut rng: StdRng = SeedableRng::from_seed(seed);
+ let word = rng.gen();
+ word
+}
+
+#[test]
+fn beale_rng_test() {
+ let rand_word = make_beale_word();
+ assert_eq!(rand_word, BealeWord::new("ladder"))
+}
+
+#[test]
+fn reinhold_rng_test() {
+ let rand_word = make_reinhold_word();
+ assert_eq!(rand_word, ReinholdWord::new("ks"))
+}