Files
Nonemm/tests/Nonemm.Session.Tests/QtcMessagesTests.cs
T
erikbrockoandClaude Opus 5 f24cab0ae5 Work QTC traffic on RTTY the way N1MM does
The QTC window put nothing on the air on RTTY except the lines themselves,
so the operator typed the rest into the digital window's transmit pane and
copied the lines by hand. N1MM sends a message for each step and fills the
lines in from a click. Both are here now, with N1MM's messages, N1MM's
defaults and N1MM's settings behind them.

The messages, all of them settings in the QTC window's setup area:

- RX Ready, `WAERXReadyText`, `{ENTERLF}I AM QRV BK`
- All Agn, `WAEAllAgnText`, `{ENTERLF}ALL AGN ALL AGN BK`
- Agn n, `WAEAGNText`, `{ENTERLF}AGN QTC: $ $ $ `, where `$` is the line
- Save, `WAESaveQTCText`, `{ENTERLF}R R R ALL OK BK`
- R U QRV, `WAERUQRVText`, `{ENTERLF}R U QRV BK`
- Save, reading traffic out, `WAESSaveQTCText`, `{ENTERLF}GL DE {MYCALL}`

Each keys the transmitter, sends the text and drops it again, and an empty
one sends nothing. The line spacing default is N1MM's `{ENTERLF}` rather
than `{ENTER}`, which was wrong.

The buttons: R U QRV and Snd Hdr were hidden while reading traffic out on
RTTY, though that is where N1MM starts — R U QRV is the first button
pressed. All Agn is new, and so is the S button on each line, which strikes
a line through a QTC that arrived too broken to read so the rows after it
keep their places; Agn n clears the strike and asks for that line again.

Clicking a line in the digital window fills the next row, which is how the
series is copied on RTTY: the other station sends the header and all ten
lines in one transmission. A click anywhere in a line hands the whole line
to the QTC window, which reads the time, the callsign and the serial number
out of it by shape and flashes the line to show it was taken. A line that is
not a QTC is left to mean what a click always means there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
2026-09-10 20:03:18 +00:00

120 lines
3.8 KiB
C#

namespace Nonemm.Session.Tests;
public class QtcMessagesTests
{
[Fact]
public void ALineIsTheTimeTheCallAndTheSerialNumber()
{
Assert.Equal(
"1234 DL1ABC 123",
QtcMessages.Line("1234", "DL1ABC", "123", QtcMessages.DefaultFieldSpacing));
}
/// N1MM writes the spacing with `S` for a space, so an operator who wants
/// two writes `SS`.
[Fact]
public void TheSpacingIsWrittenWithSForASpace()
{
Assert.Equal("1234 DL1ABC 123", QtcMessages.Line("1234", "DL1ABC", "123", "SS"));
}
[Fact]
public void AnythingElseInTheSpacingGoesOutAsItIs()
{
Assert.Equal("1234/DL1ABC/123", QtcMessages.Line("1234", "DL1ABC", "123", "/"));
}
/// N1MM lets the TU message name the series it is closing.
[Fact]
public void TheTuMessageCanCarryTheHeader()
{
Assert.Equal("TU QTC 3/10 73", QtcMessages.Tu("TU {QTC} 73", "QTC 3/10"));
}
[Fact]
public void ATuMessageWithoutTheHeaderIsLeftAlone()
{
Assert.Equal("TU 73", QtcMessages.Tu("TU 73", "QTC 3/10"));
}
/// N1MM joins the three fields with hyphens on RTTY and offers no setting
/// for it.
[Fact]
public void ARttyLineIsTheThreeFieldsJoinedWithHyphens()
{
Assert.Equal("1234-DL1ABC-123", QtcMessages.RttyLine(" 1234 ", " DL1ABC ", " 123 "));
}
/// The shape is N1MM's, from `QTCWindow.cs:3609`: the heading, the spacing,
/// then every line with a space and the spacing behind it, then the ending.
/// The macros are left for the expander; `{QTC}` is the one filled in here.
[Fact]
public void SendAllReadsTheWholeSeriesOutInOneMessage()
{
string message = QtcMessages.SendAll(
QtcMessages.DefaultSendAllHeading,
QtcMessages.DefaultSendAllEnding,
QtcMessages.DefaultRttySpacing,
"QTC 3/10",
["1234-DL1ABC-123", "1240-G3XYZ-124"]);
Assert.Equal(
"{TX}{ENTERLF}QTC 3/10 QTC 3/10{ENTERLF}"
+ "1234-DL1ABC-123 {ENTERLF}"
+ "1240-G3XYZ-124 {ENTERLF}"
+ "{ENTERLF}QSL?? BK DE {MYCALL} K{RX}",
message);
}
[Fact]
public void SendAllWithNoLinesSendsNothing()
{
Assert.Equal(
"",
QtcMessages.SendAll(
QtcMessages.DefaultSendAllHeading,
QtcMessages.DefaultSendAllEnding,
QtcMessages.DefaultRttySpacing,
"QTC 3/10",
[]));
}
/// One line asked for again, which N1MM wraps in the spacing on both sides.
[Fact]
public void OneLineKeysAndDropsTheTransmitterOfItsOwn()
{
Assert.Equal(
"{TX}{ENTERLF}1234-DL1ABC-123{ENTERLF}{RX}",
QtcMessages.SendOne(QtcMessages.DefaultRttySpacing, "1234-DL1ABC-123"));
}
/// The short RTTY messages: N1MM keys the transmitter, sends the text and
/// drops it again for each of them.
[Fact]
public void AShortRttyMessageKeysAndDropsTheTransmitter()
{
Assert.Equal(
"{TX}{ENTERLF}I AM QRV BK{RX}",
QtcMessages.Rtty(QtcMessages.DefaultRttyReady));
Assert.Equal(
"{TX}{ENTERLF}AGN QTC: 5 5 5 {ENTERLF}{RX}",
QtcMessages.Rtty(
QtcMessages.LineAgain(QtcMessages.DefaultRttyLineAgain, 5),
QtcMessages.DefaultRttySpacing));
}
/// A message the operator has emptied sends nothing at all, which is
/// N1MM's "Not Set".
[Fact]
public void AnEmptyRttyMessageSendsNothing() =>
Assert.Equal("", QtcMessages.Rtty(" "));
[Fact]
public void WhatIsInTheBoxesIsTrimmed()
{
Assert.Equal(
"1234 DL1ABC 123",
QtcMessages.Line(" 1234 ", " DL1ABC ", " 123 ", QtcMessages.DefaultFieldSpacing));
}
}