One step of an incremental test, after the caller edited the tree: index * `repo` incrementally into `inc_db`, then fully into a fresh `full_db`, and * require identical MENTIONS edges and unresolved rows AND the expected * route. Returns 0, or -1 after printing what differs (`what` names the * step). */
| 234 | * route. Returns 0, or -1 after printing what differs (`what` names the |
| 235 | * step). */ |
| 236 | static inline int dm_step(const char *repo, const char *inc_db, const char *full_db, |
| 237 | const char *what, cbm_incremental_route_t want_route) { |
| 238 | cbm_pipeline_incremental_test_reset_faults(); |
| 239 | if (dm_index(repo, inc_db, NULL) != 0) { |
| 240 | printf(" %s: incremental index failed\n", what); |
| 241 | return -1; |
| 242 | } |
| 243 | cbm_incremental_route_t route = cbm_pipeline_incremental_test_last_route(); |
| 244 | dm_unlink_db(full_db); |
| 245 | if (dm_index(repo, full_db, NULL) != 0) { |
| 246 | printf(" %s: full index failed\n", what); |
| 247 | return -1; |
| 248 | } |
| 249 | char *inc = dm_doclink_state(inc_db); |
| 250 | char *full = dm_doclink_state(full_db); |
| 251 | int rc = 0; |
| 252 | if (!inc || !full || strcmp(inc, full) != 0) { |
| 253 | printf(" %s: incremental != full\n--- incremental (route %d)\n%s--- full\n%s", what, |
| 254 | (int)route, inc ? inc : "(null)", full ? full : "(null)"); |
| 255 | rc = -1; |
| 256 | } else if (route != want_route) { |
| 257 | printf(" %s: route %d, expected %d\n", what, (int)route, (int)want_route); |
| 258 | rc = -1; |
| 259 | } |
| 260 | free(inc); |
| 261 | free(full); |
| 262 | return rc; |
| 263 | } |
| 264 | |
| 265 | /* ── one worker == several workers ───────────────────────────────── */ |
| 266 |
no test coverage detected