Files
Nonemm/tests/Nonemm.Contests.Tests/ArrlDxTests.cs
ericek111 5c0ca558c1 Score the last three cases the way N1MM scores them
The three differences left after replaying the log were ours on purpose. A log
has to score the same in both programs, so they now follow N1MM:

- ARRL DX and CQ WW RTTY count the 14 Canadian areas N1MM lists as `48SDC14P`,
  which keeps Newfoundland apart from Labrador. A station sending the postal
  code is counted as the area the contest names.
- A maritime mobile is scored from the call it signs. CQ WW says it counts for
  the zone alone; N1MM gives it the country, and so do we.
- A callsign the country file cannot place counts as a multiplier with an empty
  value, so every unplaceable call worked on a band shares one multiplier.

29 of the 37 contest instances in the log now agree with N1MM on every contact
and on the totals. What is left is the country file of the day and rows whose
cached points N1MM never worked out again after a call was corrected.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
2026-08-31 08:36:44 +00:00

79 lines
2.7 KiB
C#

using Nonemm.Contests.Rules;
using Nonemm.Core;
namespace Nonemm.Contests.Tests;
public class ArrlDxTests
{
private static ContestLog LogFor(StationInfo me) =>
new(new ArrlDx(ModeCategory.Cw), me, TestLog.CountryFile);
[Fact]
public void DxWorkingWvieScoresThree()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal(3, log.Judge(TestLog.Contact("K1ABC", section: "CT")).Points);
}
[Fact]
public void DxWorkingDxScoresNothing()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal(0, log.Judge(TestLog.Contact("JA1XYZ", exchange: "5W")).Points);
}
[Fact]
public void WvieWorkingWvieScoresNothing()
{
ContestLog log = LogFor(TestLog.UnitedStates);
Assert.Equal(0, log.Judge(TestLog.Contact("VE3XYZ", exchange: "ON")).Points);
}
[Fact]
public void DxCountsStatesAndProvinces()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal("CT", log.Judge(TestLog.Contact("K1ABC", section: "CT")).NewMultipliers.Single().Value);
Assert.Empty(log.Judge(TestLog.Contact("K1ABC", section: "XX")).NewMultipliers);
}
[Fact]
public void WvieCountsCountries()
{
ContestLog log = LogFor(TestLog.UnitedStates);
Assert.Equal("DL", log.Judge(TestLog.Contact("DL9XYZ", exchange: "100")).NewMultipliers.Single().Value);
}
[Fact]
public void MultipliersCountOncePerBand()
{
ContestLog log = LogFor(TestLog.Germany);
log.Add(TestLog.Contact("K1ABC", section: "CT"));
Assert.Empty(log.Judge(TestLog.Contact("K2ABC", section: "CT")).NewMultipliers);
Assert.Single(log.Judge(TestLog.Contact("K2ABC", 7_025, section: "CT")).NewMultipliers);
}
/// A Canadian station sends the postal code or the older abbreviation, and
/// Newfoundland and Labrador is one province either way. N1MM counts `NF`
/// and `LB` as two multipliers, which is two for one province.
[Fact]
public void NewfoundlandAndLabradorCountOnce()
{
ContestLog log = new(new ArrlDx(ModeCategory.Phone), TestLog.Germany, TestLog.CountryFile);
log.Add(TestLog.Contact("VO1XYZ", section: "NF"));
Assert.Empty(log.Judge(TestLog.Contact("VO2XYZ", section: "LB")).NewMultipliers);
}
[Theory]
[InlineData("QB", "QC")]
[InlineData("PE", "PEI")]
[InlineData("NT", "NWT")]
public void AnotherSpellingIsTheSameArea(string sent, string counted)
{
ContestLog log = new(new ArrlDx(ModeCategory.Phone), TestLog.Germany, TestLog.CountryFile);
Assert.Equal(
counted,
log.Judge(TestLog.Contact("VA2XYZ", section: sent)).NewMultipliers.Single().Value);
}
}