Let the published .udc files score the contests they are written for

I wrote SA 10 and OK/OM DX SSB in code after two failed attempts at the
download. The download works — the page posts a nonce with the form — and the
files say I got both contests wrong.

SA 10 is deleted from the code. Its file scores the station's log to the
contact, where the code had the wrong Cabrillo name and counted its multipliers
once in the contest rather than once per mode.

OK/OM DX now covers the CW running only, which is what N1MM's class is for and
what N1MM's own documentation says: the SSB running has different rules and a
pair of .udc files, one for each side. The CW rules go back to the class, so
Czechia and Slovakia are one side of the contest again. With the SSB files in
place both of the station's SSB logs score to the contact.

Reading those files turned up four things in the .udc reader: a file whose
extension is upper case was passed over, `Country` was not read as a
multiplier source, `OtherCountry` was not a points condition, and a section
multiplier counted the serial numbers the other side of a contest sends.

All Asian stays in code — N1MM has a class for it after all — with the Cabrillo
name and the band table it uses.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
2026-08-31 10:00:21 +00:00
parent 264036f0f2
commit 38e9010802
13 changed files with 151 additions and 155 deletions

View File

@@ -6,20 +6,23 @@ namespace Nonemm.Contests.Tests;
public class OkOmDxTests
{
private static readonly Contest Ssb = new OkOmDx(ModeCategory.Phone);
private static readonly Contest Cw = new OkOmDx();
private static ContestLog LogFor(StationInfo me) => new(Ssb, me, TestLog.CountryFile);
private static ContestLog LogFor(StationInfo me) => new(Cw, me, TestLog.CountryFile);
private static Qso FromOkOm(string call, string county, double kilohertz = 14_025) =>
TestLog.Contact(call, kilohertz, mode: Modes.Usb, section: county);
TestLog.Contact(call, kilohertz, section: county);
private static Qso FromDx(string call, string number, double kilohertz = 14_025) =>
TestLog.Contact(call, kilohertz, mode: Modes.Usb, exchange: number);
TestLog.Contact(call, kilohertz, exchange: number);
/// The CW running counts Czechia and Slovakia as one side of the contest:
/// two points either way. The SSB running splits them, and it has its own
/// pair of .udc files.
[Theory]
[InlineData("OM3XYZ", 2)]
[InlineData("OK1XYZ", 3)]
public void AtHomeCzechiaAndSlovakiaAreTwoCountries(string call, int expected) =>
[InlineData("OK1XYZ", 2)]
public void EitherSideOfTheContestIsTwoPointsAtHome(string call, int expected) =>
Assert.Equal(expected, LogFor(TestLog.Slovakia).Judge(FromOkOm(call, "NOV")).Points);
[Theory]
@@ -36,40 +39,39 @@ public class OkOmDxTests
public void AStationOutsideScoresTenForAnOkOmContact(string call, int expected) =>
Assert.Equal(expected, LogFor(TestLog.Germany).Judge(FromOkOm(call, "NOV")).Points);
/// An OK or OM operator counts the prefixes it works and nothing for the
/// other side of the contest.
[Fact]
public void CountriesAndCountiesBothCountOncePerBand()
public void AnOkOmOperatorCountsPrefixes()
{
ContestLog log = LogFor(TestLog.Slovakia);
Assert.Equal(
[1, 2],
log.Judge(FromOkOm("OM3XYZ", "NOV")).NewMultipliers.Select(m => m.Index).ToList());
log.Add(FromOkOm("OM3XYZ", "NOV"));
Assert.Empty(log.Judge(FromOkOm("OM4XYZ", "NOV")).NewMultipliers);
Assert.Single(log.Judge(FromOkOm("OM4XYZ", "PAR")).NewMultipliers);
Assert.Equal("IK2", log.Judge(FromDx("IK2XYZ", "014")).NewMultipliers.Single().Value);
Assert.Empty(log.Judge(FromOkOm("OM3XYZ", "NOV")).NewMultipliers);
}
/// A station outside counts the counties instead.
[Fact]
public void AStationOutsideOkOmBringsItsCountryAndNoCounty() =>
Assert.Equal(
[1],
LogFor(TestLog.Slovakia).Judge(FromDx("IK2XYZ", "014")).NewMultipliers
.Select(m => m.Index)
.ToList());
public void EveryoneElseCountsCounties()
{
ContestLog log = LogFor(TestLog.Germany);
Assert.Equal("NOV", log.Judge(FromOkOm("OM3XYZ", "NOV")).NewMultipliers.Single().Value);
Assert.Empty(log.Judge(FromDx("IK2XYZ", "014")).NewMultipliers);
}
/// The entry window walks the county box for an OK or OM station and the
/// serial box for everyone else.
[Fact]
public void OnlyOneOfTheTwoBoxesIsWalked()
{
IReadOnlyList<ExchangeField> fields = Ssb.ExchangeFieldsFor(TestLog.Slovakia);
IReadOnlyList<ExchangeField> fields = Cw.ExchangeFieldsFor(TestLog.Slovakia);
CountryLookup? okom = TestLog.CountryFile.Find("OM3XYZ");
CountryLookup? dx = TestLog.CountryFile.Find("IK2XYZ");
Assert.Equal(
[ExchangeSlot.ReceivedReport, ExchangeSlot.Exchange1],
fields.Where(f => !Ssb.SkipsField(f, dx)).Select(f => f.Slot).ToList());
fields.Where(f => !Cw.SkipsField(f, dx)).Select(f => f.Slot).ToList());
Assert.Equal(
[ExchangeSlot.ReceivedReport, ExchangeSlot.Section],
fields.Where(f => !Ssb.SkipsField(f, okom)).Select(f => f.Slot).ToList());
fields.Where(f => !Cw.SkipsField(f, okom)).Select(f => f.Slot).ToList());
}
}