diff options
| author | Christoph Berg <myon@debian.org> | 2026-10-14 14:39:32 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-10-14 14:39:32 +0200 |
| commit | cc627cc2a9a66014fa25c4c2c81c1b26833564e4 (patch) | |
| tree | 47f39d2c2d0f7228a5c9dd91c1b7213471272d21 /tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp | |
| parent | 95a9df4014710930dc3011546ca0673e7531c1ce (diff) | |
| parent | c576a4281ef8c87990ae6399393a827dfaccacd5 (diff) | |
Update upstream source from tag 'upstream/3.3.0_beta2+dfsg'
Update to upstream version '3.3.0~beta2+dfsg'
with Debian dir 2b24afa6aafe083cbcb475061c2678a067f4608b
Diffstat (limited to 'tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp')
| -rw-r--r-- | tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp b/tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp index c2b3b45b..25fa54b0 100644 --- a/tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp +++ b/tests/unit/jtty/jtty_cpp_n1mm_smoke.cpp @@ -80,3 +80,40 @@ extern "C" int jtty_cpp_rtty_smoke (int tones[], int* nsym) } return status; } + +extern "C" int jtty_cpp_rtty_line_refused () +{ + // 80 characters; RTTY Roundup writes the serial as 005, which makes it 81. + QString const line = QString (73, QLatin1Char {'A'}) + QStringLiteral (" 599 05"); + auto encodesWith = [] (Jtty::NativeExchangeProfile exchange) { + return [profile = static_cast<int> (exchange)] (QString const& text) { + auto frame = Jtty::transmitFrame (text).toLatin1 (); + std::array<int, 16 * 59> tones {}; + std::array<int, 16> frameStarts {}; + int symbols {}; + int const isFinal = 0; + genjtty_profile_ (frame.data (), &profile, tones.data (), &symbols, + frameStarts.data (), &isFinal, frame.size ()); + return symbols > 0; + }; + }; + auto const rtty = Jtty::encodeTransmitLine (line, encodesWith (Jtty::NativeExchangeProfile::RttyRoundup)); + auto const none = Jtty::encodeTransmitLine (line, encodesWith (Jtty::NativeExchangeProfile::None)); + return !rtty && none && none->size () == 1; +} + +extern "C" int jtty_cpp_rtty_line_tones (int tones[], int* nsym) +{ + // 79 characters; with the serial written as 005 it is exactly 80. + QString const line = QString (72, QLatin1Char {'A'}) + QStringLiteral (" 599 05"); + int const profile = static_cast<int> (Jtty::NativeExchangeProfile::RttyRoundup); + auto encode = [&] (QString const& text, int isFinal) { + auto frame = Jtty::transmitFrame (text).toLatin1 (); + std::array<int, 16> frameStarts {}; + *nsym = 0; + genjtty_profile_ (frame.data (), &profile, tones, nsym, frameStarts.data (), &isFinal, frame.size ()); + return *nsym > 0; + }; + auto const segments = Jtty::encodeTransmitLine (line, [&] (QString const& text) { return encode (text, 0); }); + return segments && segments->size () == 1 && encode (segments->front ().text, 1); +} |
