You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
527 B
25 lines
527 B
3 years ago
|
use short_fibonacci::*;
|
||
|
|
||
|
#[test]
|
||
|
fn test_empty() {
|
||
|
assert_eq!(create_empty(), Vec::new());
|
||
|
}
|
||
|
#[test]
|
||
|
fn test_buffer() {
|
||
|
for n in 0..10 {
|
||
|
let zeroized = create_buffer(n);
|
||
|
assert_eq!(zeroized.len(), n);
|
||
|
assert!(zeroized.iter().all(|&v| v == 0));
|
||
|
}
|
||
|
}
|
||
|
#[test]
|
||
|
fn test_fibonacci() {
|
||
|
let fibb = fibonacci();
|
||
|
assert_eq!(fibb.len(), 5);
|
||
|
assert_eq!(fibb[0], 1);
|
||
|
assert_eq!(fibb[1], 1);
|
||
|
for window in fibb.windows(3) {
|
||
|
assert_eq!(window[0] + window[1], window[2]);
|
||
|
}
|
||
|
}
|