Score CQ WW RTTY as its own contest

CQWWRTTY resolved to the built-in CQ WW with the mode set to digital, and then
scored it as though it were the CW running: a contact inside your own country
worth nothing, two multiplier types, and CQ-WW-SSB in the Cabrillo header. Every
one of those is wrong for RTTY, and wrong quietly, which is the worst way.

RTTY is a different contest wearing the same name. Every contact scores — 1
inside your own country, 2 on your own continent, 3 off it. The exchange carries
the state or province after the zone, and that is a third multiplier per band.
A station outside the US and Canada sends DX there, so the box is not required
and DX brings no multiplier.

The state box being optional is deliberate: most of the log is DX stations, and
holding up an entry for a box that will hold DX costs more than it is worth.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-27 23:37:54 +00:00
parent 0ef12ff8be
commit 86c01f246f
5 changed files with 189 additions and 20 deletions

View File

@@ -0,0 +1,93 @@
using Nonemm.Contests.Rules;
using Nonemm.Core;
namespace Nonemm.Contests.Tests;
/// CQ WW RTTY is scored differently from the CW and SSB running of the same
/// contest, so it gets its own tests rather than sharing them.
public class CqWorldWideRttyTests
{
private static readonly Contest Rtty = new CqWorldWide(ModeCategory.Digital);
private static ContestLog LogFor(StationInfo me) => new(Rtty, me, TestLog.CountryFile);
private static Qso Contact(string call, int zone, string stateOrProvince = "") =>
TestLog.Contact(call, mode: Modes.Rtty, zone: zone, section: stateOrProvince);
[Fact]
public void ContactInsideYourOwnCountryScoresOne()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal(1, log.Judge(Contact("DL9XYZ", 14)).Points);
}
[Fact]
public void SameContinentScoresTwo()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal(2, log.Judge(Contact("IK2XYZ", 15)).Points);
}
[Fact]
public void DifferentContinentScoresThree()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal(3, log.Judge(Contact("JA1XYZ", 25)).Points);
}
[Fact]
public void TheStateIsAThirdMultiplier()
{
ContestLog log = LogFor(TestLog.Germany);
Verdict verdict = log.Judge(Contact("K1ABC", 5, "CT"));
Assert.Equal(
["5", "K", "CT"],
verdict.NewMultipliers.Select(m => m.Value).ToList());
}
[Fact]
public void AStationOutsideTheUnitedStatesAndCanadaBringsNoStateMultiplier()
{
ContestLog log = LogFor(TestLog.Germany);
Verdict verdict = log.Judge(Contact("JA1XYZ", 25, "DX"));
Assert.Equal(["25", "JA"], verdict.NewMultipliers.Select(m => m.Value).ToList());
}
[Fact]
public void TheStateCountsAgainOnAnotherBand()
{
ContestLog log = LogFor(TestLog.Germany);
log.Add(Contact("K1ABC", 5, "CT"));
Verdict verdict = log.Judge(
TestLog.Contact("K2DEF", kilohertz: 7_040, mode: Modes.Rtty, zone: 5, section: "CT"));
Assert.Contains(verdict.NewMultipliers, m => m.Value == "CT");
}
[Fact]
public void TheThreeMultiplierNamesAreShown() =>
Assert.Equal(["Zones", "Countries", "States"], Rtty.MultiplierNames);
[Fact]
public void TheCabrilloNameIsTheRttyOne() => Assert.Equal("CQ-WW-RTTY", Rtty.CabrilloName);
/// A station outside the US and Canada sends DX in the state column.
[Fact]
public void TheSentExchangeCarriesTheStateOrDx()
{
Assert.Equal("14 DX", Rtty.SentExchangeFor(TestLog.Germany));
Assert.Equal("5 CT", Rtty.SentExchangeFor(TestLog.UnitedStates));
}
[Fact]
public void TheExchangeHasAStateBoxThatIsNotRequired()
{
IReadOnlyList<ExchangeField> fields = Rtty.ExchangeFieldsFor(TestLog.Germany);
Assert.Equal(3, fields.Count);
Assert.Equal(ExchangeSlot.Section, fields[2].Slot);
Assert.False(fields[2].IsRequired);
}
}