Commit 9a7ce9e
sim(#750): finalize waitCrossing conversion — fix tolerance gap, correct comment, add regression tests
Verifies and closes out the waitCrossing conversion from 16fb70c now that
kDisco 0.6.1-SNAPSHOT (with waitCrossing) is locally publishable and the
build works again:
- Generator.kt: correct a comment that overclaimed velocity-target events
are root-found — only block-boundary and tail-entry were converted;
Motor's AccelerationStopCondition still uses plain waitUntil. The
Motor/dtMax follow-up is now tracked separately in issue #760.
- SimpleTestProcess.kt: fix a real regression exposed by the conversion.
This test coordinator never runs Generator, so it silently relied on
kDisco's own raw defaults (dtMin=1e-5, maxAbsError=1e-5 — nearly equal
in magnitude). The waitCrossing guards intentionally leave a structural
gap of exactly `dtMin` at the moment a threshold is reached (see the
existing Train.kt comments on why that slack is necessary), which is
negligible against the intended maxAbsError=1e-2 but trips
LengthChecker's invariant when left at kDisco's near-equal raw
defaults. Confirmed via A/B test against 74cd41b (same kDisco version,
pre-conversion Train.kt) that this is new, not pre-existing. Fixed by
configuring the same tolerances Generator.startAction() sets.
- SimpleTestProcessTest.kt: relax an assertion that assumed `position`
stays >= 0 immediately after a block-boundary crossing. The
waitCrossing guard deliberately fires `dtMin` short of the boundary so
it reliably crosses zero instead of asymptoting forever; this leaves a
bounded, harmless negative transient that was never a documented
invariant.
- SimpleLinearTrackTestProcessTest.kt: add an explicit regression test
proving both converted call sites fire correctly end-to-end.
Verified locally: kDisco published to mavenLocal from
copilot/add-zero-crossing-detection (feaa058), full build/test/
integrationTest/heavyTest all green (0 failures across all JUnit reports).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>1 parent 16fb70c commit 9a7ce9e
4 files changed
Lines changed: 81 additions & 7 deletions
File tree
- core/src
- commonMain/kotlin/cz/vutbr/fit/interlockSim/sim
- commonTest/kotlin/cz/vutbr/fit/interlockSim/sim
- jvmTest/kotlin/cz/vutbr/fit/interlockSim/sim
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | 18 | | |
15 | 19 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
124 | 140 | | |
125 | 141 | | |
126 | 142 | | |
| |||
Lines changed: 52 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
247 | 297 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
251 | 257 | | |
252 | 258 | | |
253 | 259 | | |
0 commit comments