Files
Nonemm/tests/Nonemm.Core.Tests/CallsignTests.cs
Erik 0f84bc8972 Add the core, contest, storage and format layers
Frequencies, bands, modes, callsigns, grid squares and the country file live in
Nonemm.Core. Nonemm.Contests holds the scoring engine and CQ WW and CQ WPX.
Nonemm.Storage writes N1MM's DXLOG schema, and Nonemm.Formats writes Cabrillo
3.0 and reads and writes ADIF.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 10:27:51 +00:00

56 lines
1.7 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());
}