Add the twelve contests left in the station's log
REF, the Ukrainian DX contest, the BARTG Sprint, ARRL 10M, Russian DX RTTY, RDAC, YO DX HF, Oceania DX, IARU Region 1 Field Day, SARTG RTTY, All Asian and SA 10. Every contest name in the log now opens, and every one of these but Field Day scores its log contact for contact as N1MM did. Most are written from N1MM's own class and checked against the log. Three things the log settled that the class does not say plainly: ARRL 10M counts its multipliers once per mode rather than once, the BARTG Sprint counts a continent once in the contest while its countries and call areas count per band, and RDAC counts nothing but the districts and scores nothing for a station that sends none. All Asian and SA 10 have no class in N1MM, which logs them from a .udc file, so those two are written from the published rules and the log. docs/unfinished.md lists what is still not settled. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoGtneMQaz4M9w7Kk49AVD
This commit is contained in:
38
tests/Nonemm.Contests.Tests/Arrl10MetreTests.cs
Normal file
38
tests/Nonemm.Contests.Tests/Arrl10MetreTests.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Nonemm.Contests.Rules;
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
public class Arrl10MetreTests
|
||||
{
|
||||
private static ContestLog LogFor() => new(new Arrl10Metre(), TestLog.Germany, TestLog.CountryFile);
|
||||
|
||||
private static Qso Contact(string call, Mode mode, string state = "", string number = "") =>
|
||||
TestLog.Contact(call, 28_025, mode: mode, section: state, exchange: number);
|
||||
|
||||
[Fact]
|
||||
public void CwIsWorthFourAndPhoneTwo()
|
||||
{
|
||||
ContestLog log = LogFor();
|
||||
Assert.Equal(4, log.Judge(Contact("K1ABC", Modes.Cw, state: "CT")).Points);
|
||||
Assert.Equal(2, log.Judge(Contact("K1ABC", Modes.Usb, state: "CT")).Points);
|
||||
}
|
||||
|
||||
/// The contest is one band and counts its multipliers once per mode.
|
||||
[Fact]
|
||||
public void AMultiplierCountsOncePerMode()
|
||||
{
|
||||
ContestLog log = LogFor();
|
||||
log.Add(Contact("K1ABC", Modes.Cw, state: "CT"));
|
||||
Assert.Empty(log.Judge(Contact("K2ABC", Modes.Cw, state: "CT")).NewMultipliers);
|
||||
Assert.Single(log.Judge(Contact("K2ABC", Modes.Usb, state: "CT")).NewMultipliers);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AStationWithNoStateBringsItsCountry() =>
|
||||
Assert.Equal(
|
||||
[2],
|
||||
LogFor().Judge(Contact("JA1XYZ", Modes.Cw, number: "042")).NewMultipliers
|
||||
.Select(m => m.Index)
|
||||
.ToList());
|
||||
}
|
||||
30
tests/Nonemm.Contests.Tests/FrenchRefTests.cs
Normal file
30
tests/Nonemm.Contests.Tests/FrenchRefTests.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Nonemm.Contests.Rules;
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
public class FrenchRefTests
|
||||
{
|
||||
private static ContestLog LogFor() =>
|
||||
new(new FrenchRef(ModeCategory.Phone), TestLog.Germany, TestLog.CountryFile);
|
||||
|
||||
private static Qso Contact(string call, string department = "", string number = "") =>
|
||||
TestLog.Contact(call, mode: Modes.Usb, section: department, exchange: number);
|
||||
|
||||
[Theory]
|
||||
[InlineData("F5XYZ", 1)]
|
||||
[InlineData("IK2XYZ", 1)]
|
||||
[InlineData("JA1XYZ", 3)]
|
||||
public void AStationOutsideFranceScoresByContinent(string call, int expected) =>
|
||||
Assert.Equal(expected, LogFor().Judge(Contact(call, department: "03")).Points);
|
||||
|
||||
/// A French department is the multiplier, and so is a French entity
|
||||
/// overseas, but an ordinary DX contact is neither.
|
||||
[Fact]
|
||||
public void OnlyFranceBringsAMultiplier()
|
||||
{
|
||||
ContestLog log = LogFor();
|
||||
Assert.Equal("03", log.Judge(Contact("F5XYZ", department: "03")).NewMultipliers.Single().Value);
|
||||
Assert.Empty(log.Judge(Contact("JA1XYZ", number: "001")).NewMultipliers);
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ public class N1mmContestNamesTests
|
||||
|
||||
[Fact]
|
||||
public void AContestNeitherProgramKnowsIsStillAnError() =>
|
||||
Assert.Throws<KeyNotFoundException>(() => Registry().Create("BARTGSRTTY", ModeCategory.Digital));
|
||||
Assert.Throws<KeyNotFoundException>(() => Registry().Create("NOSUCHCONTEST", ModeCategory.Digital));
|
||||
|
||||
[Fact]
|
||||
public void HasFindsAContestByTheNameN1mmWrote() =>
|
||||
|
||||
29
tests/Nonemm.Contests.Tests/OceaniaDxTests.cs
Normal file
29
tests/Nonemm.Contests.Tests/OceaniaDxTests.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Nonemm.Contests.Rules;
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
public class OceaniaDxTests
|
||||
{
|
||||
private static ContestLog LogFor() =>
|
||||
new(new OceaniaDx(ModeCategory.Phone), TestLog.Germany, TestLog.CountryFile);
|
||||
|
||||
[Theory]
|
||||
[InlineData(1_830, 20)]
|
||||
[InlineData(3_650, 10)]
|
||||
[InlineData(7_050, 5)]
|
||||
[InlineData(14_150, 1)]
|
||||
public void TheLowerTheBandTheMorePoints(double kilohertz, int expected) =>
|
||||
Assert.Equal(
|
||||
expected,
|
||||
LogFor().Judge(TestLog.Contact("VK4XYZ", kilohertz, mode: Modes.Usb)).Points);
|
||||
|
||||
/// One side of the contact has to be in Oceania.
|
||||
[Fact]
|
||||
public void AContactOutsideOceaniaScoresNothing()
|
||||
{
|
||||
Verdict verdict = LogFor().Judge(TestLog.Contact("IK2XYZ", mode: Modes.Usb));
|
||||
Assert.Equal(0, verdict.Points);
|
||||
Assert.Empty(verdict.NewMultipliers);
|
||||
}
|
||||
}
|
||||
27
tests/Nonemm.Contests.Tests/RussianDistrictAwardTests.cs
Normal file
27
tests/Nonemm.Contests.Tests/RussianDistrictAwardTests.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Nonemm.Contests.Rules;
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
public class RussianDistrictAwardTests
|
||||
{
|
||||
private static ContestLog LogFor() =>
|
||||
new(new RussianDistrictAward(), TestLog.Germany, TestLog.CountryFile);
|
||||
|
||||
/// Only a station that sends a district counts.
|
||||
[Fact]
|
||||
public void ADistrictIsTenPointsAndAMultiplier()
|
||||
{
|
||||
Verdict verdict = LogFor().Judge(TestLog.Contact("UA3XYZ", section: "MA12"));
|
||||
Assert.Equal(10, verdict.Points);
|
||||
Assert.Equal("MA12", verdict.NewMultipliers.Single().Value);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AStationWithNoDistrictScoresNothing()
|
||||
{
|
||||
Verdict verdict = LogFor().Judge(TestLog.Contact("IK2XYZ"));
|
||||
Assert.Equal(0, verdict.Points);
|
||||
Assert.Empty(verdict.NewMultipliers);
|
||||
}
|
||||
}
|
||||
97
tests/Nonemm.Contests.Tests/SmallContestTests.cs
Normal file
97
tests/Nonemm.Contests.Tests/SmallContestTests.cs
Normal file
@@ -0,0 +1,97 @@
|
||||
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());
|
||||
|
||||
[Theory]
|
||||
[InlineData(14_150, 1)]
|
||||
[InlineData(7_050, 2)]
|
||||
[InlineData(3_650, 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("PY2XYZ", 4)]
|
||||
[InlineData("IK2XYZ", 2)]
|
||||
public void SouthAmericaTenPaysMoreForSouthAmerica(string call, int expected) =>
|
||||
Assert.Equal(
|
||||
expected,
|
||||
LogFor(new SouthAmerica10())
|
||||
.Judge(TestLog.Contact(call, 28_400, mode: Modes.Usb, section: "11"))
|
||||
.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);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,16 @@ public static class TestLog
|
||||
OM;
|
||||
Czech Republic: 15: 28: EU: 49.80: -15.47: -1.0: OK:
|
||||
OK,OL;
|
||||
France: 14: 27: EU: 46.00: 2.00: -1.0: F:
|
||||
F;
|
||||
Ukraine: 16: 29: EU: 50.00: -30.00: -2.0: UR:
|
||||
UR,US,UT,UY,UZ,EM,EO;
|
||||
European Russia: 16: 29: EU: 55.75: -37.62: -3.0: UA:
|
||||
UA,RA,RN,RV,RW,RX,RZ,R3;
|
||||
Romania: 20: 28: EU: 45.50: -25.00: -2.0: YO:
|
||||
YO,YP,YQ,YR;
|
||||
Australia: 30: 59: OC: -23.70: -133.87: -10.0: VK:
|
||||
VK,AX;
|
||||
""";
|
||||
|
||||
public static readonly CountryFile CountryFile = CountryFile.Parse(Countries);
|
||||
|
||||
25
tests/Nonemm.Contests.Tests/UkrainianDxTests.cs
Normal file
25
tests/Nonemm.Contests.Tests/UkrainianDxTests.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Nonemm.Contests.Rules;
|
||||
using Nonemm.Core;
|
||||
|
||||
namespace Nonemm.Contests.Tests;
|
||||
|
||||
public class UkrainianDxTests
|
||||
{
|
||||
private static ContestLog LogFor() => new(new UkrainianDx(), TestLog.Germany, TestLog.CountryFile);
|
||||
|
||||
[Theory]
|
||||
[InlineData("UR5XYZ", 10)]
|
||||
[InlineData("DL9XYZ", 1)]
|
||||
[InlineData("IK2XYZ", 2)]
|
||||
[InlineData("JA1XYZ", 3)]
|
||||
public void UkraineIsWorthTen(string call, int expected) =>
|
||||
Assert.Equal(expected, LogFor().Judge(TestLog.Contact(call, section: "DO")).Points);
|
||||
|
||||
[Fact]
|
||||
public void OnlyUkraineBringsAnOblast() =>
|
||||
Assert.Equal(
|
||||
[1],
|
||||
LogFor().Judge(TestLog.Contact("IK2XYZ", section: "DO")).NewMultipliers
|
||||
.Select(m => m.Index)
|
||||
.ToList());
|
||||
}
|
||||
Reference in New Issue
Block a user