| 60 | } |
| 61 | |
| 62 | bool nearMs(std::chrono::steady_clock::duration d, int expectMs, int toleranceMs = 15) |
| 63 | { |
| 64 | const int actual = static_cast<int>( |
| 65 | std::chrono::duration_cast<std::chrono::milliseconds>(d).count()); |
| 66 | const bool ok = std::abs(actual - expectMs) <= toleranceMs; |
| 67 | if (!ok) std::cout << " actual=" << actual << "ms expected=" << expectMs << "ms\n"; |
| 68 | return ok; |
| 69 | } |
| 70 | |
| 71 | // Convenience: compute durations between consecutive on/off events. |
| 72 | std::vector<int> elementDurationsMs(const std::vector<KeyEvent>& evs) |
no test coverage detected