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
90 lines
3.2 KiB
C#
90 lines
3.2 KiB
C#
using Nonemm.Contests.Rules;
|
|
using Nonemm.Core;
|
|
|
|
namespace Nonemm.Contests.Tests;
|
|
|
|
/// The contests whose rules are one table each: what a contact scores and
|
|
/// where its multiplier comes from.
|
|
public class SmallContestTests
|
|
{
|
|
private static ContestLog LogFor(Contest contest) =>
|
|
new(contest, TestLog.Germany, TestLog.CountryFile);
|
|
|
|
[Theory]
|
|
[InlineData("DL9XYZ", 5)]
|
|
[InlineData("IK2XYZ", 10)]
|
|
[InlineData("JA1XYZ", 15)]
|
|
public void SartgScoresByCountryAndContinent(string call, int expected) =>
|
|
Assert.Equal(
|
|
expected,
|
|
LogFor(new SartgRtty()).Judge(TestLog.Contact(call, mode: Modes.Rtty)).Points);
|
|
|
|
/// The SARTG call area is a second multiplier next to the country.
|
|
[Fact]
|
|
public void SartgCountsCallAreasAsWellAsCountries() =>
|
|
Assert.Equal(
|
|
[1, 2],
|
|
LogFor(new SartgRtty())
|
|
.Judge(TestLog.Contact("K1ABC", mode: Modes.Rtty, section: "K1"))
|
|
.NewMultipliers.Select(m => m.Index).ToList());
|
|
|
|
/// 160 metres pays 3, 80 and 10 metres 2, and the rest 1.
|
|
[Theory]
|
|
[InlineData(14_150, 1)]
|
|
[InlineData(7_050, 1)]
|
|
[InlineData(3_650, 2)]
|
|
[InlineData(1_830, 3)]
|
|
public void AllAsianScoresByBand(double kilohertz, int expected) =>
|
|
Assert.Equal(
|
|
expected,
|
|
LogFor(new AllAsian(ModeCategory.Phone))
|
|
.Judge(TestLog.Contact("JA1XYZ", kilohertz, mode: Modes.Usb, exchange: "46"))
|
|
.Points);
|
|
|
|
[Fact]
|
|
public void AllAsianCountsOnlyAsia() =>
|
|
Assert.Equal(
|
|
0,
|
|
LogFor(new AllAsian(ModeCategory.Phone))
|
|
.Judge(TestLog.Contact("IK2XYZ", mode: Modes.Usb, exchange: "46"))
|
|
.Points);
|
|
|
|
[Theory]
|
|
[InlineData("YO3XYZ", 8)]
|
|
[InlineData("DL9XYZ", 1)]
|
|
[InlineData("IK2XYZ", 2)]
|
|
[InlineData("JA1XYZ", 4)]
|
|
public void YoDxHfPaysEightForRomania(string call, int expected) =>
|
|
Assert.Equal(expected, LogFor(new YoDxHf()).Judge(TestLog.Contact(call, section: "AR")).Points);
|
|
|
|
[Theory]
|
|
[InlineData("IK2XYZ", 5)]
|
|
[InlineData("JA1XYZ", 10)]
|
|
public void RussianDxRttyScoresByContinent(string call, int expected) =>
|
|
Assert.Equal(
|
|
expected,
|
|
LogFor(new RussianDxRtty()).Judge(TestLog.Contact(call, mode: Modes.Rtty, section: "14")).Points);
|
|
|
|
[Theory]
|
|
[InlineData("IK2XYZ/P", 5)]
|
|
[InlineData("IK2XYZ", 2)]
|
|
[InlineData("JA1XYZ", 3)]
|
|
public void FieldDayPaysMostForAPortableStation(string call, int expected) =>
|
|
Assert.Equal(
|
|
expected,
|
|
LogFor(new FieldDayRegionOne()).Judge(TestLog.Contact(call, number: 22)).Points);
|
|
|
|
/// Every contact is one point, and the continent counts once in the whole
|
|
/// contest rather than once per band.
|
|
[Fact]
|
|
public void BartgCountsAContinentOnce()
|
|
{
|
|
ContestLog log = LogFor(new BartgSprint());
|
|
Assert.Equal(1, log.Judge(TestLog.Contact("IK2XYZ", mode: Modes.Rtty)).Points);
|
|
log.Add(TestLog.Contact("IK2XYZ", mode: Modes.Rtty));
|
|
Assert.DoesNotContain(
|
|
log.Judge(TestLog.Contact("F5XYZ", 7_040, mode: Modes.Rtty)).NewMultipliers,
|
|
m => m.Index == 3);
|
|
}
|
|
}
|