Double-click a cell in the log window to change it. The columns follow the contest exchange instead of being fixed in the XAML, so CQ WW gets a Zone column and Sweepstakes gets Nr, Prec, Ck and Sec. QsoEditor holds the column list and applies one field edit. Validation comes from the ExchangeFieldKind the contest declared: a CQ zone is 1 to 40, an ITU zone 1 to 90, a section is looked up in the ARRL list, a grid must parse. A refused edit returns the reason and leaves the log alone, so the cell reverts. Changing the callsign runs the country lookup again. Delete, or the right-click menu, removes the selected contact after a confirmation. Either way the log is rescored, so a multiplier the removed contact held passes to the next contact that claims it. Both go out to the other stations in N1MM's own messages: contactreplace carries oldcall and oldtimestamp, contactdelete names the contact. An incoming edit or delete is matched by contact id first, falling back to call plus timestamp because N1MM does not know our ids. Country, continent and the two prefixes were filled in twice, once when logging and once when editing. They now come from CountryFields. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Core.Tests;
|
|
|
|
public class CallsignTests
|
|
{
|
|
[Theory]
|
|
[InlineData("N8BJQ", "N8")]
|
|
[InlineData("9A1AA", "9A1")]
|
|
[InlineData("K1ABC", "K1")]
|
|
[InlineData("VP2EXX", "VP2")]
|
|
[InlineData("LZ1400PS", "LZ1400")]
|
|
public void WpxPrefixEndsAtTheLastDigit(string call, string expected) =>
|
|
Assert.Equal(expected, Callsign.Parse(call).WpxPrefix());
|
|
|
|
[Fact]
|
|
public void CallWithNoDigitTakesAZeroAfterTwoLetters() =>
|
|
Assert.Equal("RA0", Callsign.Parse("RAEM").WpxPrefix());
|
|
|
|
[Theory]
|
|
[InlineData("KH9/N8BJQ")]
|
|
[InlineData("N8BJQ/KH9")]
|
|
public void PortablePrefixBecomesTheWpxPrefix(string call) =>
|
|
Assert.Equal("KH9", Callsign.Parse(call).WpxPrefix());
|
|
|
|
[Fact]
|
|
public void PortablePrefixWithNoDigitGainsAZero() =>
|
|
Assert.Equal("PA0", Callsign.Parse("PA/N8BJQ").WpxPrefix());
|
|
|
|
[Fact]
|
|
public void SingleDigitModifierReplacesTheDigit() =>
|
|
Assert.Equal("N9", Callsign.Parse("N8BJQ/9").WpxPrefix());
|
|
|
|
[Fact]
|
|
public void PortableModifierChangesNothing()
|
|
{
|
|
Callsign call = Callsign.Parse("DL1ABC/P");
|
|
Assert.Equal("DL1", call.WpxPrefix());
|
|
Assert.Null(call.PortablePrefix);
|
|
Assert.Equal("DL1ABC", call.Station);
|
|
}
|
|
|
|
[Fact]
|
|
public void MaritimeMobileCountsForNothing()
|
|
{
|
|
Callsign call = Callsign.Parse("DL1ABC/MM");
|
|
Assert.True(call.IsMaritimeMobile);
|
|
Assert.False(call.CountsForEntity);
|
|
Assert.Null(call.WpxPrefix());
|
|
}
|
|
|
|
[Fact]
|
|
public void PortablePrefixIsWhatTheCountryFileGetsAsked() =>
|
|
Assert.Equal("KH9", Callsign.Parse("KH9/N8BJQ").EntityLookupText());
|
|
|
|
[Theory]
|
|
[InlineData("JA1XYZ")]
|
|
[InlineData("DL1ABC/P")]
|
|
[InlineData("KH9/N8BJQ")]
|
|
[InlineData("9A1A")]
|
|
public void ACallThatCouldHaveBeenIssuedIsPlausible(string text) =>
|
|
Assert.True(Callsign.Parse(text).IsPlausible);
|
|
|
|
[Theory]
|
|
[InlineData("12345")]
|
|
[InlineData("ABCDE")]
|
|
[InlineData("AB")]
|
|
[InlineData("JA1XY Z")]
|
|
[InlineData("")]
|
|
public void ATextThatCouldNotBeACallIsNot(string text) =>
|
|
Assert.False(Callsign.Parse(text).IsPlausible);
|
|
}
|