Files
Nonemm/tests/Nonemm.Contests.Tests/AllAsianTests.cs
T
erikbrockoandClaude Opus 5 b5d9f1e21c Name the All Asian multiplier after what it counts
The score window and the stored Contest.Multiplier1Name row both said
"Prefixes" for an Asian entrant, which counts DXCC entities.

Contest.MultiplierNames is now MultiplierNamesFor(StationInfo me), the
same shape as ExchangeFieldsFor. Every other contest returns the same
list it did before; All Asian returns "Countries" from Asia and
"Prefixes" from everywhere else. ContestDefinitions.For takes the
station as well, because that name is written to the log for N1MM.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0157i7PiZyqBkquxS9A6FTdQ
2026-09-10 20:47:51 +00:00

101 lines
3.6 KiB
C#

using Nonemm.Contests.Rules;
using Nonemm.Core;
namespace Nonemm.Contests.Tests;
/// All Asian is two contests in one class: an entrant outside Asia works Asia
/// for prefixes, and an Asian entrant works everybody else for countries and
/// three times the points.
public class AllAsianTests
{
private static ContestLog LogFor(StationInfo me) =>
new(new AllAsian(ModeCategory.Phone), me, TestLog.CountryFile);
private static Qso Contact(string call, double kilohertz = 14_150) =>
TestLog.Contact(call, kilohertz, mode: Modes.Usb, exchange: "46");
/// An Asian entrant scores the band table for another Asian station.
[Theory]
[InlineData(14_150, 1)]
[InlineData(7_050, 1)]
[InlineData(3_650, 2)]
[InlineData(28_450, 2)]
[InlineData(1_830, 3)]
public void AsianEntrantScoresAsiaAtFaceValue(double kilohertz, int expected) =>
Assert.Equal(
expected,
LogFor(TestLog.Japan).Judge(Contact("UA9XYZ", kilohertz)).Points);
/// Outside Asia is where an Asian entrant earns three times as much.
[Theory]
[InlineData(14_150, 3)]
[InlineData(3_650, 6)]
[InlineData(28_450, 6)]
[InlineData(1_830, 9)]
public void AsianEntrantScoresTrebleOutsideAsia(double kilohertz, int expected) =>
Assert.Equal(
expected,
LogFor(TestLog.Japan).Judge(Contact("DL9XYZ", kilohertz)).Points);
/// Two stations in the same country cannot work each other.
[Fact]
public void AsianEntrantCannotWorkItsOwnCountry()
{
Verdict verdict = LogFor(TestLog.Japan).Judge(Contact("JA1XYZ"));
Assert.Equal(0, verdict.Points);
Assert.Empty(verdict.NewMultipliers);
}
/// An Asian entrant counts countries, not WPX prefixes.
[Fact]
public void AsianEntrantCountsCountries() =>
Assert.Equal(
["K"],
LogFor(TestLog.Japan).Judge(Contact("K1ABC")).NewMultipliers.Select(m => m.Value));
/// An entrant outside Asia counts the WPX prefixes of the Asian stations.
[Fact]
public void OutsideEntrantCountsPrefixes() =>
Assert.Equal(
["JA1"],
LogFor(TestLog.Germany).Judge(Contact("JA1XYZ")).NewMultipliers.Select(m => m.Value));
/// A maritime mobile is worth nothing to an entrant outside Asia, and
/// brings no multiplier to anybody.
[Fact]
public void MaritimeMobileScoresNothingOutsideAsia()
{
Verdict verdict = LogFor(TestLog.Germany).Judge(Contact("JA1XYZ/MM"));
Assert.Equal(0, verdict.Points);
Assert.Empty(verdict.NewMultipliers);
}
/// A station at sea pays an Asian entrant the Asian rate, not three times
/// it, and never brings a multiplier.
[Fact]
public void MaritimeMobilePaysAnAsianEntrantTheAsianRate()
{
Verdict verdict = LogFor(TestLog.Japan).Judge(Contact("DL9XYZ/MM"));
Assert.Equal(1, verdict.Points);
Assert.Empty(verdict.NewMultipliers);
}
/// The column heading follows what is being counted.
[Fact]
public void TheMultiplierNameFollowsTheEntrant()
{
Contest contest = new AllAsian(ModeCategory.Phone);
Assert.Equal(["Countries"], contest.MultiplierNamesFor(TestLog.Japan));
Assert.Equal(["Prefixes"], contest.MultiplierNamesFor(TestLog.Germany));
}
/// An entrant outside Asia may only work Asia.
[Fact]
public void OutsideEntrantCannotWorkOutsideAsia()
{
Verdict verdict = LogFor(TestLog.Germany).Judge(Contact("IK2XYZ"));
Assert.Equal(0, verdict.Points);
Assert.Empty(verdict.NewMultipliers);
}
}