| 204 | |
| 205 | template <typename T> |
| 206 | bool verify_full(const std::vector<T> & out, const std::vector<T> & in) { |
| 207 | size_t n = out.size(); |
| 208 | if (in.size() != n) return false; |
| 209 | std::vector<char> seen(n, 0); |
| 210 | for (size_t i = 0; i < n; i++) { |
| 211 | int32_t ix = idx_of(out[i]); |
| 212 | if (ix < 0 || size_t(ix) >= n || seen[ix]) return false; // permutation |
| 213 | seen[ix] = 1; |
| 214 | if (key_of(out[i]) != key_of(in[size_t(ix)])) return false; // element integrity |
| 215 | if (i && key_of(out[i]) < key_of(out[i-1])) return false; // sorted |
| 216 | if (i && key_of(out[i]) == key_of(out[i-1]) && idx_of(out[i]) < idx_of(out[i-1])) return false; // stable |
| 217 | } |
| 218 | return true; |
| 219 | } |
| 220 | |
| 221 | // ============================================================================ |
| 222 | // Input patterns. idx is always the original position (0..n-1). |
no test coverage detected