+7
examples/day_04_printing_department.proptest-regressions
+7
examples/day_04_printing_department.proptest-regressions
···
1
+
# Seeds for failure cases proptest has generated in the past. It is
2
+
# automatically read and these particular cases re-run before any
3
+
# novel cases are generated.
4
+
#
5
+
# It is recommended to check this file in to source control so that
6
+
# everyone who runs the test benefits from these saved cases.
7
+
cc 2ede2633c7d67ab5e546e5c8c737e0b2a7033d69097fce43336250232de3eebb # shrinks to ch = ' '
+76
examples/day_04_printing_department.rs
+76
examples/day_04_printing_department.rs
···
1
+
fn main() {}
2
+
3
+
#[derive(Debug)]
4
+
struct Position {
5
+
x: u32,
6
+
y: u32,
7
+
}
8
+
9
+
fn is_paper_roll(ch: char) -> bool {
10
+
ch == '@'
11
+
}
12
+
13
+
fn parse_line(line: &str, y: u32) -> Vec<Position> {
14
+
vec![]
15
+
}
16
+
17
+
fn parse_input(input: &str) -> Vec<Position> {
18
+
vec![]
19
+
}
20
+
21
+
#[cfg(test)]
22
+
mod test {
23
+
use super::*;
24
+
use proptest::prelude::*;
25
+
26
+
mod is_paper_roll {
27
+
use super::*;
28
+
29
+
proptest! {
30
+
#[test]
31
+
fn doesnt_crash(ch in any::<char>()) {
32
+
is_paper_roll(ch);
33
+
}
34
+
}
35
+
36
+
#[test]
37
+
fn accepts_at_signs() {
38
+
assert!(is_paper_roll('@'));
39
+
}
40
+
41
+
proptest! {
42
+
#[test]
43
+
fn rejects_not_at_signs(ch in any::<char>().prop_filter("cannot be @", |ch| ch != &'@')) {
44
+
prop_assert!(!is_paper_roll(ch))
45
+
}
46
+
}
47
+
}
48
+
49
+
prop_compose! {
50
+
fn line(y: u32)(xs in prop::collection::vec(0_u32..100, 10..50)) -> Vec<Position> {
51
+
xs.iter().map(|x| Position { x: *x, y }).collect::<Vec<_>>()
52
+
}
53
+
}
54
+
55
+
mod parse_line {
56
+
use super::*;
57
+
58
+
// proptest! {
59
+
// #[test]
60
+
// fn doesnt_crash(s in line(y), y in any::<u32>()) {
61
+
// parse_line(&s, y);
62
+
// }
63
+
// }
64
+
}
65
+
66
+
mod parse_input {
67
+
use super::*;
68
+
69
+
proptest! {
70
+
#[test]
71
+
fn doesnt_crash(s in "\\PC+") {
72
+
parse_input(&s);
73
+
}
74
+
}
75
+
}
76
+
}