#include "echoion/core/playback/GaplessHandoff.hpp" #include namespace { int failures = 0; void expect(bool condition, const char* message) { if (!condition) { std::cerr << "FAILED: " << message << '\n'; ++failures; } } } // namespace int main() { using Echoion::Core::PlaybackDetail::canFillDeviceFrame; expect(canFillDeviceFrame(300, 700, 1000), "outgoing tail and incoming head can exactly fill a frame"); expect(canFillDeviceFrame(300, 900, 1000), "extra incoming PCM is retained for the next frame"); expect(!canFillDeviceFrame(300, 699, 1000), "handoff waits rather than padding when incoming PCM is short"); expect(!canFillDeviceFrame(0, 1000, 1000), "an empty outgoing tail is a normal track-end path"); expect(!canFillDeviceFrame(1000, 1000, 1000), "a complete outgoing frame does not need a boundary join"); return failures == 0 ? 0 : 1; }