diff --git a/README.md b/README.md index 0a55cd1..0be5505 100644 --- a/README.md +++ b/README.md @@ -255,8 +255,8 @@ Public Methods * * call - Callsign (12 characters maximum). * loc - Maidenhead grid locator (6 characters maximum). - * dbm - Output power in dBm. Valid range is -30 to 60 dBm; values are rounded - * down to the nearest valid power level. + * dbm - Output power in dBm. Values are clamped to the WSPR range 0 to 60 + * dBm, then normalized to a sendable power using WSJT-X's `nu` table. * symbols - Array of channel symbols to transmit returned by the method. * Ensure that you pass a uint8_t array of at least size WSPR_SYMBOL_COUNT to the method. * @@ -377,6 +377,23 @@ Also, a big thank you to Murray Greenman, ZL1BPU for working allowing me to pick Changelog --------- +* v1.5.1 + + * WSPR power normalization now follows the WSJT-X `ndbm + nu(mod(ndbm, 10))` table + after clamping to 0..60, instead of rounding invalid powers down through the old + `valid_dbm` table. + * Full packmsg prefix parsing is bounds-checked (`getpfx1()`), avoiding a one-byte + stack overflow for slash-prefix inputs. + * Free-text packing maps invalid characters to code 0 in both compact and full paths, + matching Fortran `packtext77`. + * Example beacon sketches limit pre-transmission WiFi reconnect time so reconnect + cannot overrun the NTP-aligned transmit slot. + * Fixed the suffix-parse precedence warning, made bounded `snprintf` precision + explicit, removed unused `trim_len`/`grid2k`, and made the RS symbol-size sign + compare explicit. + * Added regression tests for invalid free-text characters and overlong prefix cases; + the harness runs 36 checks. + * v1.5.0 * Add FT4 support (issue #37): 105-symbol FT4 encoder (4 tones at 20.833 Hz spacing, diff --git a/examples/FT4_Beacon_UnoR4WiFi/FT4_Beacon_UnoR4WiFi.ino b/examples/FT4_Beacon_UnoR4WiFi/FT4_Beacon_UnoR4WiFi.ino index 72ae470..ea7c81f 100644 --- a/examples/FT4_Beacon_UnoR4WiFi/FT4_Beacon_UnoR4WiFi.ino +++ b/examples/FT4_Beacon_UnoR4WiFi/FT4_Beacon_UnoR4WiFi.ino @@ -160,6 +160,8 @@ static const char *MSG_STRINGS[MSG_COUNT] = { // Re-sync NTP shortly before each transmission (if the last sync is older // than this) so the board's millis() drift since the last sync stays small. #define PRE_TX_SYNC_MS 15000UL +#define NTP_SYNC_MAX_MS 5000UL +#define RECONNECT_SAFETY_MS 1000UL // ---- Objects ------------------------------------------------------------------ Si5351 si5351; @@ -280,7 +282,7 @@ unsigned long now() } // ---- WiFi ---------------------------------------------------------------------- -bool connectWiFi() +bool connectWiFi(uint64_t max_ms) { Serial.print("Connecting to WiFi: "); Serial.println(SECRET_SSID); @@ -294,7 +296,7 @@ bool connectWiFi() WiFi.begin(SECRET_SSID, SECRET_PASS); unsigned long start = millis(); - while (WiFi.status() != WL_CONNECTED && (millis() - start) < 60000UL) + while (WiFi.status() != WL_CONNECTED && (uint64_t)(millis() - start) < max_ms) { delay(500); } @@ -313,6 +315,11 @@ bool connectWiFi() return false; } +bool connectWiFi() +{ + return connectWiFi(60000ULL); +} + // ---- Time formatting ------------------------------------------------------------ // Prints "HH:MM:SS" (UTC) for an epoch time. void printTime(unsigned long epoch) @@ -519,9 +526,12 @@ void loop() { if (WiFi.status() != WL_CONNECTED) { - // WiFi dropped: reconnect and re-sync; the slot target is unchanged - // (the local clock keeps running from millis() in the meantime). - connectWiFi(); + // WiFi dropped: reconnect within a budget that leaves room for the + // following NTP resync before the transmit slot. + uint64_t budget = remaining > (NTP_SYNC_MAX_MS + RECONNECT_SAFETY_MS) + ? remaining - NTP_SYNC_MAX_MS - RECONNECT_SAFETY_MS + : 0; + connectWiFi(budget); syncTime(); continue; } diff --git a/examples/FT8_Beacon_UnoR4WiFi/FT8_Beacon_UnoR4WiFi.ino b/examples/FT8_Beacon_UnoR4WiFi/FT8_Beacon_UnoR4WiFi.ino index 9dec7d6..a6a77c6 100644 --- a/examples/FT8_Beacon_UnoR4WiFi/FT8_Beacon_UnoR4WiFi.ino +++ b/examples/FT8_Beacon_UnoR4WiFi/FT8_Beacon_UnoR4WiFi.ino @@ -159,6 +159,8 @@ static const char *MSG_STRINGS[MSG_COUNT] = { // Re-sync NTP shortly before each transmission (if the last sync is older // than this) so the board's millis() drift since the last sync stays small. #define PRE_TX_SYNC_MS 15000UL +#define NTP_SYNC_MAX_MS 5000UL +#define RECONNECT_SAFETY_MS 1000UL // ---- Objects ------------------------------------------------------------------ Si5351 si5351; @@ -279,7 +281,7 @@ unsigned long now() } // ---- WiFi ---------------------------------------------------------------------- -bool connectWiFi() +bool connectWiFi(uint64_t max_ms) { Serial.print("Connecting to WiFi: "); Serial.println(SECRET_SSID); @@ -293,7 +295,7 @@ bool connectWiFi() WiFi.begin(SECRET_SSID, SECRET_PASS); unsigned long start = millis(); - while (WiFi.status() != WL_CONNECTED && (millis() - start) < 60000UL) + while (WiFi.status() != WL_CONNECTED && (uint64_t)(millis() - start) < max_ms) { delay(500); } @@ -312,6 +314,11 @@ bool connectWiFi() return false; } +bool connectWiFi() +{ + return connectWiFi(60000ULL); +} + // ---- Time formatting ------------------------------------------------------------ // Prints "HH:MM:SS" (UTC) for an epoch time. void printTime(unsigned long epoch) @@ -518,9 +525,12 @@ void loop() { if (WiFi.status() != WL_CONNECTED) { - // WiFi dropped: reconnect and re-sync; the slot target is unchanged - // (the local clock keeps running from millis() in the meantime). - connectWiFi(); + // WiFi dropped: reconnect within a budget that leaves room for the + // following NTP resync before the transmit slot. + uint64_t budget = remaining > (NTP_SYNC_MAX_MS + RECONNECT_SAFETY_MS) + ? remaining - NTP_SYNC_MAX_MS - RECONNECT_SAFETY_MS + : 0; + connectWiFi(budget); syncTime(); continue; } diff --git a/library.properties b/library.properties index a8004a7..1ebe43a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Etherkit JTEncode -version=1.5.0 +version=1.5.1 author=Jason Milldrum maintainer=Jason Milldrum sentence=Generate JT65, JT9, JT4, FT8, FT4, WSPR, and FSQ symbols on your Arduino. diff --git a/src/JTEncode.cpp b/src/JTEncode.cpp index c4a9ab4..fd0f3d0 100644 --- a/src/JTEncode.cpp +++ b/src/JTEncode.cpp @@ -725,7 +725,7 @@ void JTEncode::ft_message_prep(char * message) uint8_t i; char temp_msg[14]; - snprintf(temp_msg, 14, "%13s", message); + snprintf(temp_msg, sizeof(temp_msg), "%13.13s", message); // Convert all chars to uppercase for(i = 0; i < 13; i++) @@ -812,36 +812,18 @@ void JTEncode::wspr_message_prep(char * call, char * loc, int8_t dbm) memset(locator, 0, sizeof(locator)); strncpy(locator, loc, sizeof(locator) - 1); - // Power level validation - // Only certain increments are allowed - if(dbm > 60) + // Power level normalization + // WSJT-X clamps to 0..60 and maps invalid powers with the `nu` table. + if(dbm < 0) { - dbm = 60; + dbm = 0; } - if(dbm < -30) + if(dbm > 60) { - dbm = -30; + dbm = 60; } - const uint8_t VALID_DBM_SIZE = 28; - const int8_t valid_dbm[VALID_DBM_SIZE] = - {-30, -27, -23, -20, -17, -13, -10, -7, -3, - 0, 3, 7, 10, 13, 17, 20, 23, 27, 30, 33, 37, 40, - 43, 47, 50, 53, 57, 60}; - for(i = 0; i < VALID_DBM_SIZE; i++) - { - if(dbm == valid_dbm[i]) - { - power = dbm; - } - } - // If we got this far, we have an invalid power level, so we'll round down - for(i = 1; i < VALID_DBM_SIZE; i++) - { - if(dbm < valid_dbm[i] && dbm >= valid_dbm[i - 1]) - { - power = valid_dbm[i - 1]; - } - } + static const int8_t nu[10] = {0, -1, 1, 0, -1, 2, 1, 0, -1, 1}; + power = dbm + nu[dbm % 10]; } void JTEncode::jt65_bit_packing(char * message, uint8_t * c) @@ -1250,7 +1232,7 @@ void JTEncode::ft8_bit_packing(char* message, uint8_t* codeword) memset(c18, 0, 19); memmove(c18, message, i0 + 1); - snprintf(temp_msg, 19, "%18s", c18); + snprintf(temp_msg, sizeof(temp_msg), "%18.18s", c18); // Convert all chars to uppercase for(i = 0; i < strlen(temp_msg); i++) @@ -1313,6 +1295,7 @@ void JTEncode::ft8_bit_packing(char* message, uint8_t* codeword) for(i = 0; i < 13; ++i) { x = ft_code(message[i]); + if (x == 255) x = 0; // match packtext77: unknown character -> blank // mult ireg = 0; diff --git a/src/init_rs_int.cpp b/src/init_rs_int.cpp index 2cecf74..f744a95 100644 --- a/src/init_rs_int.cpp +++ b/src/init_rs_int.cpp @@ -30,7 +30,7 @@ void * JTEncode::init_rs_int(int symsize, int gfpoly, int fcr, int prim, rs = ((struct rs *)0); /* Check parameter ranges */ - if(symsize < 0 || symsize > 8*sizeof(data_t)){ + if(symsize < 0 || symsize > static_cast(8 * sizeof(data_t))){ goto done; } diff --git a/src/upstream_pack77.cpp b/src/upstream_pack77.cpp index 050b615..a91f8af 100644 --- a/src/upstream_pack77.cpp +++ b/src/upstream_pack77.cpp @@ -388,7 +388,6 @@ static int pack77_1(int nwords, int nw[19], char w[19][13], int &i3, int &n3, ui if (nwords != 2) { const char *wlast = w[nwords - 1]; char c1 = wlast[0]; - char c2 = (len_trim(wlast, 13) >= 2) ? wlast[1] : ' '; bool is_grid4_last = is_grid4(wlast); bool is_report_plus = (c1 == '+' || c1 == '-'); bool is_report_rplus = (strncmp(wlast, "R+", 2) == 0 || strncmp(wlast, "R-", 2) == 0); @@ -532,7 +531,7 @@ static int hex2int_impl(char ch) { static void ft_message_prep_impl(char *message) { char temp_msg[14]; - snprintf(temp_msg, 14, "%13s", message); + snprintf(temp_msg, sizeof(temp_msg), "%13.13s", message); for (int i = 0; i < 13; i++) { if (temp_msg[i] >= 'a' && temp_msg[i] <= 'z') temp_msg[i] = to_upper(temp_msg[i]); } @@ -575,7 +574,7 @@ static int telemetry_pack(char *message, uint8_t c[77], int &i3, int &n3) { if (ntel1 >= (1 << 23)) return -1; char temp_msg[19]; - snprintf(temp_msg, 19, "%18s", c18); + snprintf(temp_msg, sizeof(temp_msg), "%18.18s", c18); for (i = 0; i < 18; i++) temp_msg[i] = to_upper(temp_msg[i]); strncpy(message, temp_msg, 18); message[18] = 0; @@ -623,6 +622,7 @@ static void free_text_pack(char *message, uint8_t c[77], int &i3, int &n3) { for (i = 0; i < 13; ++i) { x = ft_code_impl(message[i]); + if (x == 255) x = 0; // match packtext77: unknown character -> blank // mult: ireg = 42 * qa + carry ireg = 0; for (j = 0; j < 9; ++j) { diff --git a/src/upstream_packmsg.cpp b/src/upstream_packmsg.cpp index b0baf9b..7620954 100644 --- a/src/upstream_packmsg.cpp +++ b/src/upstream_packmsg.cpp @@ -114,9 +114,6 @@ static int my_atoi(const char *s) { return 0; } -static int trim_len(const char *s) { // trim trailing blanks - return len_trim(s); -} // fmtmsg: uppercase, collapse multiple blanks into one, find last non-blank static void fmtmsg(char *msg, int &iz) { @@ -182,15 +179,6 @@ static void deg2grid(double dlong0, double dlat, char *grid) { grid[6] = 0; } -// grid2k / k2grid (for the prefix-derived grid path) -static void grid2k(const char *grid6, int &k) { - double dlong, dlat; - grid2deg(grid6, dlong, dlat); - int nlong = (int)(dlong + 0.5); - int nlat = (int)(dlat + 0.5); - k = 0; - if (nlat >= 85) k = 5 * (nlong + 179) / 2 + nlat - 84; -} static void k2grid(int k, char *grid) { int nlong = 2 * (int)((k - 1) / 5 % 90) - 179; @@ -246,7 +234,7 @@ static void packcall(const char *callsign, uint32_t &ncall, bool &text) { int n1 = 0, n2 = 0, n3 = 0, n4 = 0, n5 = 0, n6 = 0; if ((tmp[0] >= 'A' && tmp[0] <= 'Z') || tmp[0] == ' ') n1 = 1; if (tmp[0] >= '0' && tmp[0] <= '9') n1 = 1; - if ((tmp[1] >= 'A' && tmp[1] <= 'Z') || tmp[1] >= '0' && tmp[1] <= '9') n2 = 1; + if ((tmp[1] >= 'A' && tmp[1] <= 'Z') || (tmp[1] >= '0' && tmp[1] <= '9')) n2 = 1; if (tmp[2] >= '0' && tmp[2] <= '9') n3 = 1; if ((tmp[3] >= 'A' && tmp[3] <= 'Z') || tmp[3] == ' ') n4 = 1; if ((tmp[4] >= 'A' && tmp[4] <= 'Z') || tmp[4] == ' ') n5 = 1; @@ -353,15 +341,20 @@ static void getpfx1(char *callsign, int &k, int &nv2) { int islash = 0; for (int i = 0; i < iz; i++) if (orig[i] == '/') { islash = i + 1; break; } // 1-indexed - if (islash > 0 && islash <= iz - 4) { - // Add-on prefix + int prefix_len = islash > 0 ? islash - 1 : 0; + int suffix_len = islash > 0 ? iz - islash : 0; + + if (islash > 0 && prefix_len <= 4 && islash <= iz - 4) { + // Add-on prefix. pfx_table entries are four real characters; do not + // write a terminating NUL outside the four-character entry area. char c[5] = {' ', ' ', ' ', ' ', ' '}; - strncpy(c, orig, islash - 1); - c[islash - 1] = 0; - // trim trailing blanks from c - int cl = len_trim(c); + for (int i = 0; i < prefix_len; i++) c[i] = orig[i]; + int cl = prefix_len; for (int i = 0; i < 339; i++) { - char entry[5] = {(char)UPF_READ_BYTE(&pfx_table[i * 4 + 0]), (char)UPF_READ_BYTE(&pfx_table[i * 4 + 1]), (char)UPF_READ_BYTE(&pfx_table[i * 4 + 2]), (char)UPF_READ_BYTE(&pfx_table[i * 4 + 3]), 0}; + char entry[5] = {(char)UPF_READ_BYTE(&pfx_table[i * 4 + 0]), + (char)UPF_READ_BYTE(&pfx_table[i * 4 + 1]), + (char)UPF_READ_BYTE(&pfx_table[i * 4 + 2]), + (char)UPF_READ_BYTE(&pfx_table[i * 4 + 3]), 0}; int el = len_trim(entry); if (el == cl) { bool match = true; @@ -371,17 +364,16 @@ static void getpfx1(char *callsign, int &k, int &nv2) { } if (nv2 == 2) { // rebuild callsign to the part after the slash - memmove(callsign, &orig[islash], iz - islash); - callsign[iz - islash] = 0; + memmove(callsign, &orig[islash], suffix_len); + callsign[suffix_len] = 0; return; } // custom addpfx (k=449) — no custom prefix table here; fall through // to the generic path (Fortran: k stays 0, nv2 stays 1). - } else if (islash > 0 && islash == iz - 1) { + } else if (islash > 0 && suffix_len == 1) { // Add-on suffix char c[4] = {' ', ' ', ' ', ' '}; - strncpy(c, &orig[islash], iz - islash); - c[iz - islash] = 0; + c[0] = orig[islash]; for (int i = 0; i < 12; i++) { if ((char)UPF_READ_BYTE(&sfx_table[i]) == c[0]) { k = 400 + i + 1; nv2 = 3; break; } } @@ -394,16 +386,9 @@ static void getpfx1(char *callsign, int &k, int &nv2) { } if (islash > 0 && k == 0) { - // prefix/suffix encoded as 1-3 chars - char lof[5] = {' ', ' ', ' ', ' ', ' '}; - strncpy(lof, orig, islash - 1); - lof[islash - 1] = 0; - char rof[5] = {' ', ' ', ' ', ' ', ' '}; - strncpy(rof, &orig[islash], iz - islash); - rof[iz - islash] = 0; - - int llof = len_trim(lof); - int lrof = len_trim(rof); + // prefix/suffix encoded as 1-4 prefix chars or 1-3 suffix chars + int llof = prefix_len; + int lrof = suffix_len; bool ispfx = (llof > 0 && llof <= 4); bool issfx = (lrof > 0 && lrof <= 3); bool invalid = !(ispfx || issfx); @@ -422,14 +407,19 @@ static void getpfx1(char *callsign, int &k, int &nv2) { return; } + char lof[5] = {' ', ' ', ' ', ' ', ' '}; + char rof[5] = {' ', ' ', ' ', ' ', ' '}; + for (int i = 0; i < llof && i < 4; i++) lof[i] = orig[i]; + for (int i = 0; i < lrof && i < 3; i++) rof[i] = orig[islash + i]; + if (ispfx) { int kk = 0; for (int i = 0; i < 4; i++) kk = 37 * kk + nchar(lof[i]); k = kk; nv2 = 4; // rebuild callsign to the part after the slash - memmove(callsign, &orig[islash], iz - islash); - callsign[iz - islash] = 0; + memmove(callsign, &orig[islash], suffix_len); + callsign[suffix_len] = 0; } if (issfx) { int kk = 0; diff --git a/tests/harness.cpp b/tests/harness.cpp index c86111c..52aa3cc 100644 --- a/tests/harness.cpp +++ b/tests/harness.cpp @@ -329,6 +329,30 @@ static int test_de_prefix_not_telemetry() #endif } +static int test_ft4_free_text_invalid_char() +{ +#ifndef JTENCODE_FULL_PACKMSG + return 0; +#else + char buf[37]; + memset(buf, 0, sizeof(buf)); + strncpy(buf, "A!", 36); + uint8_t c[77]; + memset(c, 0, sizeof(c)); + UpstreamPack77::upstream_pack77(buf, c); + // Independent Fortran packtext77 reference: invalid char maps to code 0 + // (blank), so "A!" packs as "A " plus 11 blanks. + static const uint8_t expected[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 + }; + for (int i = 0; i < 77; i++) if (c[i] != expected[i]) return 1; + return 0; +#endif +} + static int test_ft4_type12_type2_bit_exact() { #ifndef JTENCODE_FULL_PACKMSG @@ -641,13 +665,18 @@ static int test_wspr_invalid_power_uninitialized() printf("power still at sentinel -1 for dbm=-100\n"); return 1; } + if (enc.power != 0) { + printf("power = %d for dbm=-100 (expected 0 from WSJT-X clamping)\n", (int)enc.power); + return 1; + } - // Rounding: dbm=55 must round down to 53 (nearest valid power below) + // WSJT-X normalizes invalid powers with `nu`, not simple round-down. + // dbm=55 mod10=5 -> nu[5]=2 -> 57. JTEncode enc2; enc2.power = -1; enc2.wspr_encode("NT7S", "CN85", 55, symbols); - if (enc2.power != 53) { - printf("power = %d for dbm=55 (expected 53)\n", (int)enc2.power); + if (enc2.power != 57) { + printf("power = %d for dbm=55 (expected 57)\n", (int)enc2.power); return 1; } @@ -659,6 +688,26 @@ static int test_wspr_invalid_power_uninitialized() printf("power = %d for dbm=60 (expected 60)\n", (int)enc3.power); return 1; } + + // Other `nu` normalization cases that diverged from round-down table. + static const struct { int dbm; int expected; } nu_cases[] = { + {39, 40}, + {49, 50}, + {61, 60}, + {-1, 0}, + {-28, 0}, + }; + for (size_t i = 0; i < sizeof(nu_cases) / sizeof(nu_cases[0]); i++) { + JTEncode e; + e.power = -1; + e.wspr_encode("NT7S", "CN85", (int8_t)nu_cases[i].dbm, symbols); + if (e.power != nu_cases[i].expected) { + printf("power = %d for dbm=%d (expected %d)\n", + (int)e.power, nu_cases[i].dbm, nu_cases[i].expected); + return 1; + } + } + return 0; } @@ -804,6 +853,7 @@ int main() {"ft8_type12_bit_exact", "ft8_encode Type 1/2 bit-exact vs WSJT-X reference (WA9XYZ KA1ABC R FN42)", test_ft8_type12_bit_exact}, {"ft4_type12_bit_exact", "ft4_encode Type 1/2 bit-exact vs WSJT-X reference (WA9XYZ KA1ABC R FN42)", test_ft4_type12_bit_exact}, {"ft4_de_prefix_not_telemetry", "upstream_pack77: DE-prefixed message stays Type 1 (not telemetry)", test_de_prefix_not_telemetry}, + {"ft4_free_text_invalid_char", "upstream_pack77: invalid free-text character maps to code 0 (Fortran packtext77 behavior)", test_ft4_free_text_invalid_char}, {"ft4_type12_type2_bit_exact", "ft4_encode Type 2 bit-exact vs WSJT-X reference (PA3XYZ/P GM4ABC/P R JO22)", test_ft4_type12_type2_bit_exact}, {"ft4_cq_prefix_bit_exact", "ft4_encode CQ-prefixed Type 1 bit-exact (CQ NT7S AA00)", test_ft4_cq_prefix_bit_exact}, {"ft4_cq_grid_bit_exact", "ft4_encode CQ + grid bit-exact (CQ 001 K1ABC CN84)", test_ft4_cq_grid_bit_exact}, @@ -820,7 +870,7 @@ int main() {"wspr_type2_long_prefix", "WSPR Type 2 >3-char prefix overflows 4-byte prefix", test_wspr_type2_long_prefix}, {"wspr_type2_long_base_call", "WSPR Type 2 >6-char base call overflows 7-byte base_call", test_wspr_type2_long_base_call}, {"latlon_not_terminated", "latlon_to_grid: unterminated + wrong grid", test_latlon_not_terminated}, - {"wspr_invalid_power_uninitialized", "wspr_message_prep: uninit for dbm<-30 + wrong rounding", test_wspr_invalid_power_uninitialized}, + {"wspr_invalid_power_uninitialized", "wspr_message_prep: power clamped and normalized by WSJT-X `nu` table", test_wspr_invalid_power_uninitialized}, {"wspr_callsign_not_terminated", "wspr_encode leaves callsign member unterminated", test_wspr_callsign_not_terminated}, {"rs_inst_leak", "constructor allocates rs_inst; no destructor frees it", test_rs_inst_leak}, {"wspr_one_char_prefix", "WSPR 1-char prefix right-aligned into 3-char field", test_wspr_one_char_prefix}, diff --git a/tests/test_full_packmsg.cpp b/tests/test_full_packmsg.cpp index 84f6813..ca476ca 100644 --- a/tests/test_full_packmsg.cpp +++ b/tests/test_full_packmsg.cpp @@ -51,6 +51,8 @@ int main() check("NT7S K1ABC/1P CN84", 6); // plain callsign + suffix -> free text check("NT7S K1ABC -45", 1); // extended report (-45) check("NT7S K1ABC/X CN84", 6); // unparseable suffix -> free text + check("ABCDE/FGHIJ CN84", 6); // >4-char prefix stays free text / no buffer overflow + check("ABCDEF/GHIJK CN84", 6); // >4-char prefix and >3-char suffix -> free text check("NT7S K1ABC", 1); // standard message without grid // dat-byte regression check: standard message must match the