Starting Run stores the frequency in the position. The bandmap draws a purple, bold "CQ Frequency" pseudospot there, which is not added to the shared bandmap, and a click on it tunes back and sets Run. A move of more than 3 kHz (a setting on the telnet Filters tab) while running switches to search and pounce. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
94 lines
3.0 KiB
C#
94 lines
3.0 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Spotting.Tests;
|
|
|
|
public class SpotDescriptionTests
|
|
{
|
|
private static readonly DateTime At = new(2026, 5, 30, 12, 1, 0, DateTimeKind.Utc);
|
|
private static readonly DateTime Now = At.AddMinutes(41);
|
|
|
|
[Fact]
|
|
public void ASpotNamesTheSpotterTheTimeAndTheComment()
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
|
|
"K1TTT", "CW 26 dB");
|
|
|
|
Assert.Equal("14025.0 by K1TTT, 41m ago\nCW 26 dB", SpotDescription.Of(spot, Now));
|
|
}
|
|
|
|
[Fact]
|
|
public void ASpotWithoutACommentOrSpotterHasOneLine()
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Log);
|
|
|
|
Assert.Equal("14025.0, 41m ago", SpotDescription.Of(spot, Now));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("USB")]
|
|
[InlineData("lsb")]
|
|
[InlineData("SSB\a\a")]
|
|
public void ASidebandAloneIsLeftOut(string comment)
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
|
|
"K1TTT", comment);
|
|
|
|
Assert.Equal("14025.0 by K1TTT, 41m ago", SpotDescription.Of(spot, Now));
|
|
}
|
|
|
|
[Fact]
|
|
public void ControlCharactersAreDroppedFromTheComment()
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
|
|
"K1TTT", "CW 26 dB\r\a");
|
|
|
|
Assert.Equal("14025.0 by K1TTT, 41m ago\nCW 26 dB", SpotDescription.Of(spot, Now));
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(20, "14025.0, 0m ago")]
|
|
[InlineData(3600 + 300, "14025.0, 1h 5m ago")]
|
|
public void TheAgeIsInMinutesThenHours(int seconds, string expected)
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Log);
|
|
|
|
Assert.Equal(expected, SpotDescription.Of(spot, At.AddSeconds(seconds)));
|
|
}
|
|
|
|
[Fact]
|
|
public void ALocalSpotNamesTheComputerInsteadOfTheSpotter()
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Operator,
|
|
"OK1ABC")
|
|
{
|
|
Computer = "SHACK-2",
|
|
};
|
|
|
|
Assert.Equal("14025.0 by SHACK-2, 41m ago", SpotDescription.Of(spot, Now));
|
|
}
|
|
|
|
[Fact]
|
|
public void TheCqFrequencyPseudospotSaysSo() =>
|
|
Assert.Equal("14025.0, your CQ frequency", SpotDescription.Of(Spot.CqFrequency(Frequency.FromKilohertz(14_025), At), Now));
|
|
|
|
[Theory]
|
|
[InlineData("CW 26 dB 1205Z", "CW 26 dB")]
|
|
[InlineData("1205Z", "")]
|
|
[InlineData("QRP 5W1205Z", "QRP 5W1205Z")]
|
|
public void TheTimeAtTheEndOfAClusterLineIsLeftOut(string comment, string expected)
|
|
{
|
|
Spot spot = new(
|
|
Callsign.Parse("JA1XYZ"), Frequency.FromKilohertz(14_025), At, SpotSource.Cluster,
|
|
"K1TTT", comment);
|
|
|
|
string second = SpotDescription.Of(spot, Now).Split('\n').ElementAtOrDefault(1) ?? "";
|
|
Assert.Equal(expected, second);
|
|
}
|
|
}
|