Two differences from N1MM in the spot path, both found by reading Packet.cs. Randomising moved every CW spot. PacketSpot.Randomize moves a spot only when it is not a dupe, not a self spot, not on a CQ frequency, is on CW and is not working split, and Packet skips it altogether for a station passed to another band. Moving a dupe or a split station makes it harder to find, not easier, so this now leaves the same ones alone. Whether a station has been worked comes from the log, so AppSession asks it before moving a spot. Split needed knowing where a station is listening, which is in the comment. Qsx reads it by N1MM's rules: QSX, UP, DOWN, DN, U or D, the word standing alone or after a space, a bare number after QSX meaning kilohertz inside the band and anything else an offset from the spot, an offset over a hundred kilohertz refused unless it says QSX, DN70 read as a grid square rather than five down, and a listening frequency outside the band thrown away. Spots reached the bandmap one at a time, each one redrawing every window that watches it. N1MM queues them and flushes the queue once a second, which is what this does now: the filters and the randomiser run over the batch, and the bandmap takes it in one call and raises one change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Spotting.Tests;
|
|
|
|
public class QsxTests
|
|
{
|
|
private static readonly Frequency Spot = Frequency.FromKilohertz(14_025);
|
|
|
|
private static double Kilohertz(string comment) => Qsx.Parse(comment, Spot).Kilohertz;
|
|
|
|
[Fact]
|
|
public void AWholeFrequencyAfterQsxIsTakenAsItIs() =>
|
|
Assert.Equal(14_205, Kilohertz("QSX 14205"));
|
|
|
|
[Fact]
|
|
public void ABareNumberAfterQsxIsKilohertzInTheBand() =>
|
|
Assert.Equal(14_205, Kilohertz("QSX 205"));
|
|
|
|
[Fact]
|
|
public void UpAndDownAreOffsetsFromTheSpot()
|
|
{
|
|
Assert.Equal(14_027, Kilohertz("UP 2"));
|
|
Assert.Equal(14_020, Kilohertz("DN 5"));
|
|
Assert.Equal(14_020, Kilohertz("DOWN 5"));
|
|
}
|
|
|
|
[Fact]
|
|
public void ACommentThatSaysNothingAboutSplitGivesNothing()
|
|
{
|
|
Assert.Equal(0, Kilohertz("CQ TEST"));
|
|
Assert.Equal(0, Kilohertz(""));
|
|
}
|
|
|
|
[Fact]
|
|
public void AGridSquareIsNotAnOffset() =>
|
|
Assert.Equal(0, Kilohertz("TNX QSO DN70"));
|
|
|
|
[Fact]
|
|
public void AWordThatOnlyHoldsTheLettersIsNotAnOffset() =>
|
|
Assert.Equal(0, Kilohertz("GROUP 5"));
|
|
|
|
[Fact]
|
|
public void ABigNumberAfterAnythingButQsxIsNotAnOffset() =>
|
|
Assert.Equal(0, Kilohertz("UP 14205"));
|
|
|
|
[Fact]
|
|
public void AListeningFrequencyOutsideTheBandIsDropped() =>
|
|
Assert.Equal(0, Kilohertz("QSX 7205"));
|
|
|
|
[Fact]
|
|
public void TheSpotLineCarriesTheListeningFrequency()
|
|
{
|
|
Spot? spot = SpotLine.Parse(
|
|
"DX de W3LPL: 14025.0 JA1XYZ UP 2 1234Z",
|
|
new DateTime(2026, 8, 28, 12, 0, 0, DateTimeKind.Utc));
|
|
|
|
Assert.Equal(14_027_000, Assert.IsType<Spot>(spot).Qsx.Hertz);
|
|
Assert.True(spot.IsSplit);
|
|
}
|
|
}
|