Read the zone lists in the country file

The # blocks in wl_cty.dat list CQ and ITU zones by call area and the
first letter after the digit, written with the main prefix letters. A call
now takes them whatever its own prefix letters are, so RA9Y and RM9I get
what UA9Y gets, as in N1MM. A call whose own prefix rule gives a zone, and
a whole-call entry, are left as they are.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 05:50:20 +00:00
co-authored by Claude Sonnet 5.5
parent 3a39b40edb
commit 986f359a40
3 changed files with 132 additions and 4 deletions
@@ -80,4 +80,37 @@ public class CountryFileTests
[InlineData("<html>404 not found</html>")]
public void TextThatIsNotACountryFileIsRejected(string text) =>
Assert.Throws<FormatException>(() => CountryFile.Parse(text));
private const string Russia = """
Asiatic Russia: 17: 30: AS: 55.88: -84.08: -7.0: UA9:
# UA9: UA9H(18)[31],UA9J[20],
UA9Y(18)[31];
# UA0: UA0F(19)[34],UA0Z(19)[35];
R9,RA9,RM9,RZ9,RC0,UA9,UA0;
""";
/// The file lists zones by call area and the first letter after the digit
/// under UA, and N1MM applies them to every call of the entity.
[Theory]
[InlineData("UA9YA", 18, 31)]
[InlineData("RA9Y", 18, 31)]
[InlineData("RZ9YI", 18, 31)]
[InlineData("RM9J", 17, 20)]
[InlineData("RC0F", 19, 34)]
[InlineData("RA9A", 17, 30)]
public void TheZoneComesFromTheCallAreaListInTheFile(string call, int cq, int itu)
{
CountryLookup? found = CountryFile.Parse(Russia).Find(call);
Assert.Equal(cq, found?.CqZone);
Assert.Equal(itu, found?.ItuZone);
}
[Fact]
public void ACallWhoseOwnPrefixGivesAZoneIsNotChangedByTheList()
{
CountryFile file = CountryFile.Parse(Russia.Replace("RC0", "RC0(23)[40]"));
Assert.Equal(23, file.Find("RC0F")?.CqZone);
}
}