MCPcopy Create free account
hub / github.com/aethersdr/AetherSDR / nearMs

Function nearMs

tests/iambic_keyer_test.cpp:62–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62bool 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.
72std::vector<int> elementDurationsMs(const std::vector<KeyEvent>& evs)

Calls 1

countMethod · 0.80

Tested by

no test coverage detected