39 lines
640 B
Rust
39 lines
640 B
Rust
use day11::gen_valid_ips;
|
|
|
|
#[test]
|
|
fn example1() {
|
|
assert_eq!(
|
|
gen_valid_ips("25525511135"),
|
|
["255.255.11.135", "255.255.111.35"]
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn example2() {
|
|
assert_eq!(gen_valid_ips("0000"), ["0.0.0.0"]);
|
|
}
|
|
|
|
#[test]
|
|
fn example3() {
|
|
assert_eq!(gen_valid_ips("1111"), ["1.1.1.1"]);
|
|
}
|
|
|
|
#[test]
|
|
fn example4() {
|
|
assert_eq!(gen_valid_ips("010010"), ["0.10.0.10", "0.100.1.0"]);
|
|
}
|
|
|
|
#[test]
|
|
fn example5() {
|
|
assert_eq!(
|
|
gen_valid_ips("101023"),
|
|
[
|
|
"1.0.10.23",
|
|
"1.0.102.3",
|
|
"10.1.0.23",
|
|
"10.10.2.3",
|
|
"101.0.2.3"
|
|
]
|
|
);
|
|
}
|