flower field inited
This commit is contained in:
parent
73261de92d
commit
aa34abb216
7 changed files with 419 additions and 0 deletions
199
rust/flower-field/tests/flower_field.rs
Normal file
199
rust/flower-field/tests/flower_field.rs
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
use flower_field::*;
|
||||
|
||||
#[test]
|
||||
fn no_rows() {
|
||||
let input = &[];
|
||||
let expected: &[&str] = &[];
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn no_columns() {
|
||||
let input = &[""];
|
||||
let expected = &[""];
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn no_flowers() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
], &[
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn garden_full_of_flowers() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
"***",
|
||||
"***",
|
||||
"***",
|
||||
], &[
|
||||
"***",
|
||||
"***",
|
||||
"***",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn flower_surrounded_by_spaces() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
" ",
|
||||
" * ",
|
||||
" ",
|
||||
], &[
|
||||
"111",
|
||||
"1*1",
|
||||
"111",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn space_surrounded_by_flowers() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
"***",
|
||||
"* *",
|
||||
"***",
|
||||
], &[
|
||||
"***",
|
||||
"*8*",
|
||||
"***",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn horizontal_line() {
|
||||
let input = &[" * * "];
|
||||
let expected = &["1*2*1"];
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn horizontal_line_flowers_at_edges() {
|
||||
let input = &["* *"];
|
||||
let expected = &["*1 1*"];
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn vertical_line() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
" ",
|
||||
"*",
|
||||
" ",
|
||||
"*",
|
||||
" ",
|
||||
], &[
|
||||
"1",
|
||||
"*",
|
||||
"2",
|
||||
"*",
|
||||
"1",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn vertical_line_flowers_at_edges() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
"*",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"*",
|
||||
], &[
|
||||
"*",
|
||||
"1",
|
||||
" ",
|
||||
"1",
|
||||
"*",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn cross() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
" * ",
|
||||
" * ",
|
||||
"*****",
|
||||
" * ",
|
||||
" * ",
|
||||
], &[
|
||||
" 2*2 ",
|
||||
"25*52",
|
||||
"*****",
|
||||
"25*52",
|
||||
" 2*2 ",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn large_garden() {
|
||||
#[rustfmt::skip]
|
||||
let (input, expected) = (&[
|
||||
" * * ",
|
||||
" * ",
|
||||
" * ",
|
||||
" * *",
|
||||
" * * ",
|
||||
" ",
|
||||
], &[
|
||||
"1*22*1",
|
||||
"12*322",
|
||||
" 123*2",
|
||||
"112*4*",
|
||||
"1*22*2",
|
||||
"111111",
|
||||
]);
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
fn multiple_adjacent_flowers() {
|
||||
let input = &[" ** "];
|
||||
let expected = &["1**1"];
|
||||
let actual = annotate(input);
|
||||
assert_eq!(actual, expected);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue