1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
//! Boundary-value tests for [`crate::movement`] targeting the surviving
//! mutants listed in `mutants.out/missed.txt` at the repo root.
//!
//! Each test's doc comment names the mutant(s) it is designed to kill.
//! Follows the pattern established in [`super::mutation_kills_tests`].
//!
//! These tests complement the proptest-based checks in
//! [`super::proptest_tests`]: proptest samples probabilistically, which
//! misses exact-boundary mutations (`<` vs `<=`, `*` vs `+` at symmetric
//! values). Exact-constant tests close that gap.
use crate;
// ── braking_distance ────────────────────────────────────────────────
/// Kills `replace * with + in braking_distance` on the `2.0 * deceleration`
/// divisor — an asymmetric-input case that
/// [`tests::braking_tests::braking_distance_formula`] and
/// [`tests::movement_tests::braking_distance_matches_kinematic_formula`]
/// cannot distinguish because they use symmetric `v`/`d` pairs where
/// `2·d` happens to equal `2+d` (e.g. `d=2`).
///
/// With `v=4, d=5`: original `16/(2·5) = 1.6`, mutant `16/(2+5) ≈ 2.286`.
// ── tick_movement stopping_distance kernel ──────────────────────────
/// Kills `replace * with + in tick_movement` on the `speed * speed` factor
/// of `stopping_distance`.
///
/// With the speed-squared kernel, a car moving fast toward a close target
/// starts decelerating; with an additive kernel, it would keep accelerating.
/// Observable: final velocity magnitude after one tick.
/// Kills `replace * with + in tick_movement` on the `2.0 * safe_decel`
/// divisor of `stopping_distance`.
///
/// For speed=4, decel=5: original `stopping = 16/(2·5) = 1.6`; target at
/// 10 → accelerate. Mutant `16/(2+5) = 16/7 ≈ 2.29` → still accelerate.
/// Choose target near the boundary to force divergence.
///
/// Speed=4, decel=5, target=2.0: original stopping=1.6 < 2 → accelerate;
/// new vel = 4 + 5·1 = 9 (below max 10, no cap). Mutant stopping=2.29 >= 2
/// → decelerate; new vel = 4 - 5 = -1 clamped to 0. Divergence on sign
/// and magnitude.
// ── tick_movement sign-flip clamp (line 71) ─────────────────────────
/// Kills mutants on the sign-flip comparator at
/// `if velocity > 0.0 && v < 0.0 || velocity < 0.0 && v > 0.0`.
///
/// Starts with a small positive velocity and decel that pushes computed
/// `v` negative. Without the clamp, the car would reverse direction in
/// one tick — a physical impossibility for this motion profile.
/// Mirror of [`tick_movement_sign_flip_positive_clamps_to_zero`] for the
/// negative-velocity branch of the clamp OR-expression.
// ── tick_movement accelerate transition ─────────────────────────────
/// Kills `replace > with >= in tick_movement` on the `v.abs() > max_speed`
/// cap.
///
/// When `v.abs()` is strictly below `max_speed`, the cap must *not* fire.
/// A mutant that flips this to `>=` would only diverge if `v.abs() ==
/// max_speed` exactly — but at that boundary both branches produce
/// `sign * max_speed`, which equals `v` itself. Equivalent mutant.
///
/// Non-equivalent angle: assert that `v` passes through unchanged when
/// it's strictly below `max_speed`. Kills a mutant that drops the `else`
/// arm or returns `sign * max_speed` unconditionally.
// ── tick_movement opposing-velocity branch ──────────────────────────
/// Kills `replace * with + in tick_movement` on `velocity * sign < 0.0`
/// (the opposing-direction detector).
///
/// With velocity in one direction and target in the other (`vel=2`,
/// `sign=-1`):
/// - Original `velocity * sign = -2 < 0` → `opposing = true` → decelerate
/// branch: `fma(-decel·dt, sign(vel), vel) = fma(-5, +1, 2) = -3`,
/// sign-flip clamp → `0`.
/// - Mutant `velocity + sign = 1`, NOT `< 0` → `opposing = false` →
/// falls through to accelerate: `fma(accel·dt, sign, vel) =
/// fma(1, -1, 2) = 1`. The car *accelerates* further from the target
/// instead of braking back toward it.
///
/// `vel = 1.0` would coincidentally cancel: mutant accelerate produces
/// `fma(1, -1, 1) = 0`, identical to the original sign-flip clamp, so
/// the mutation survives. `vel = 2.0` breaks the symmetry.
// ── tick_movement already-arrived guard ─────────────────────────────
/// Kills `replace < with <= in tick_movement` on the `displacement.abs()
/// < EPSILON` half of the already-arrived guard. Shows the guard does
/// **not** fire when displacement is non-zero (even if velocity is at
/// EPSILON exactly), so mutants flipping the displacement check from
/// `<` to `<=` would still need a separate displacement-equals-EPSILON
/// case to diverge — and at exactly EPSILON the guard's velocity half
/// (also `<`, not `<=`) keeps the mutant equivalent. The behavioural
/// signal is "we did integrate, not short-circuit": post-tick position
/// is no longer the start position when displacement is meaningful.