Show the boxes N1MM shows for each contest
The entry window had a fixed set of boxes with a Name and Comment box beside the exchange. N1MM lays out one row of boxes per contest and nothing else, so this does the same: general logging keeps Name and Comment, and a contest gets the boxes it exchanges. Two new members on `Contest` carry the cases where the boxes and the log columns are not the same list: - `FromExchange1` spreads what was typed in one box across the log columns. Where the other station sends a serial or a district code depending on where it is, N1MM gives it one box and sorts the value into the number, section or zone column from there, so the score and the Cabrillo file read it from the same column N1MM does. - `LogFieldsFor` gives the log window its own column list. Sweepstakes takes the whole exchange in one box and logs it in four columns; `SweepstakesExchange` parses `72 A 74 SCV` in any order, reading from the last word back as N1MM does. The sent serial is now marked as not required and space steps over it along with the two report boxes, because nobody types the number going out. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015NZkFxHde1iifAQemFTHxf
This commit is contained in:
@@ -86,9 +86,9 @@ public class CqWorldWideRttyTests
|
||||
{
|
||||
IReadOnlyList<ExchangeField> fields = Rtty.ExchangeFieldsFor(TestLog.Germany);
|
||||
|
||||
Assert.Equal(3, fields.Count);
|
||||
Assert.Equal(ExchangeSlot.Section, fields[2].Slot);
|
||||
Assert.False(fields[2].IsRequired);
|
||||
Assert.Equal(4, fields.Count);
|
||||
Assert.Equal(ExchangeSlot.Section, fields[3].Slot);
|
||||
Assert.False(fields[3].IsRequired);
|
||||
}
|
||||
|
||||
/// The Canadian areas this contest counts are its own list, which splits
|
||||
|
||||
@@ -61,17 +61,24 @@ public class OkOmDxTests
|
||||
/// The entry window walks the county box for an OK or OM station and the
|
||||
/// serial box for everyone else.
|
||||
[Fact]
|
||||
public void OnlyOneOfTheTwoBoxesIsWalked()
|
||||
public void TheOneExchangeBoxHoldsACountyOrASerialNumber()
|
||||
{
|
||||
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 => !Cw.SkipsField(f, dx)).Select(f => f.Slot).ToList());
|
||||
Assert.Equal(
|
||||
[ExchangeSlot.ReceivedReport, ExchangeSlot.Section],
|
||||
fields.Where(f => !Cw.SkipsField(f, okom)).Select(f => f.Slot).ToList());
|
||||
[ExchangeSlot.SentReport, ExchangeSlot.ReceivedReport, ExchangeSlot.Exchange1],
|
||||
fields.Select(f => f.Slot).ToList());
|
||||
}
|
||||
|
||||
/// A county goes in the section column as well, where the multiplier is
|
||||
/// read from; a serial number from anywhere else does not.
|
||||
[Fact]
|
||||
public void ACountyReachesTheSectionColumn()
|
||||
{
|
||||
Qso okom = TestLog.Contact("OM3XYZ") with { CountryPrefix = "OM" };
|
||||
Qso dx = TestLog.Contact("IK2XYZ") with { CountryPrefix = "I" };
|
||||
|
||||
Assert.Equal("BAA", Cw.FromExchange1(okom with { Exchange1 = "BAA" }, "BAA").Section);
|
||||
Assert.Equal("", Cw.FromExchange1(dx with { Exchange1 = "123" }, "123").Section);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,4 +32,51 @@ public class SweepstakesTests
|
||||
[Fact]
|
||||
public void SomethingThatIsNotASectionCountsForNothing() =>
|
||||
Assert.Empty(Log().Judge(TestLog.Contact("K1ABC", section: "ZZ")).NewMultipliers);
|
||||
|
||||
/// The whole exchange goes in one box, in any order, and comes back out in
|
||||
/// four columns. These are the shapes N1MM's box takes.
|
||||
[Theory]
|
||||
[InlineData("72 A 74 SCV")]
|
||||
[InlineData("72A 74SCV")]
|
||||
[InlineData("72 A 74SCV")]
|
||||
public void TheOneBoxIsReadBackAsFourFields(string typed)
|
||||
{
|
||||
SweepstakesExchange exchange = SweepstakesExchange.Parse(typed);
|
||||
|
||||
Assert.Equal(72, exchange.Number);
|
||||
Assert.Equal("A", exchange.Precedence);
|
||||
Assert.Equal(74, exchange.Check);
|
||||
Assert.Equal("SCV", exchange.Section);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheOneBoxFillsTheContact()
|
||||
{
|
||||
Qso logged = new Sweepstakes(ModeCategory.Cw)
|
||||
.FromExchange1(TestLog.Contact("K1ABC"), "72A 74SCV");
|
||||
|
||||
Assert.Equal(72, logged.ReceivedNumber);
|
||||
Assert.Equal("A", logged.Precedence);
|
||||
Assert.Equal(74, logged.Check);
|
||||
Assert.Equal("SCV", logged.Section);
|
||||
}
|
||||
|
||||
/// The exchange is one box and four log columns, as it is in N1MM.
|
||||
[Fact]
|
||||
public void TheLogKeepsTheFourPartsApart()
|
||||
{
|
||||
Sweepstakes contest = new(ModeCategory.Cw);
|
||||
|
||||
Assert.Equal(
|
||||
[ExchangeSlot.SentNumber, ExchangeSlot.Exchange1],
|
||||
contest.ExchangeFieldsFor(TestLog.UnitedStates).Select(f => f.Slot).ToList());
|
||||
Assert.Equal(
|
||||
[
|
||||
ExchangeSlot.SerialNumber,
|
||||
ExchangeSlot.Precedence,
|
||||
ExchangeSlot.Check,
|
||||
ExchangeSlot.Section,
|
||||
],
|
||||
contest.LogFieldsFor(TestLog.UnitedStates).Select(f => f.Slot).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class UserDefinedContestTests
|
||||
|
||||
/// The sent-side boxes are in the same setting and are not exchange boxes.
|
||||
[Fact]
|
||||
public void TheSentBoxesAreLeftOutOfTheExchange()
|
||||
public void TheSentBoxesAreBoxesOfTheirOwn()
|
||||
{
|
||||
UserDefinedContest contest = new(UdcFile.Parse("""
|
||||
[Contest]
|
||||
@@ -103,7 +103,12 @@ public class UserDefinedContestTests
|
||||
"""));
|
||||
|
||||
Assert.Equal(
|
||||
[ExchangeSlot.ReceivedReport, ExchangeSlot.SerialNumber],
|
||||
[
|
||||
ExchangeSlot.SentReport,
|
||||
ExchangeSlot.SentNumber,
|
||||
ExchangeSlot.ReceivedReport,
|
||||
ExchangeSlot.SerialNumber,
|
||||
],
|
||||
contest.ExchangeFieldsFor(TestLog.Germany).Select(f => f.Slot).ToList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,34 @@ public class OperatingPositionTests
|
||||
session.Entry.Set(ExchangeSlot.Zone, zone);
|
||||
}
|
||||
|
||||
/// N1MM shows what this station sends beside what it copies, keeps both
|
||||
/// filled in and steps over them.
|
||||
[Fact]
|
||||
public void TheSentBoxesAreFilledInAndSteppedOver()
|
||||
{
|
||||
OperatingPosition session = Session(new CqWpx(ModeCategory.Cw));
|
||||
|
||||
Assert.Equal("599", session.Entry.ValueOf(ExchangeSlot.SentReport));
|
||||
Assert.Equal("1", session.Entry.ValueOf(ExchangeSlot.SentNumber));
|
||||
|
||||
// the boxes are the call, the two reports, the sent serial and the
|
||||
// serial being copied
|
||||
session.Entry.Advance();
|
||||
Assert.Equal(4, session.Entry.Focus);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TheSentSerialGoesUpWhenAContactIsLogged()
|
||||
{
|
||||
OperatingPosition session = Session(new CqWpx(ModeCategory.Cw));
|
||||
session.Entry.Call = "JA1XYZ";
|
||||
session.Entry.Set(ExchangeSlot.ReceivedReport, "599");
|
||||
session.Entry.Set(ExchangeSlot.SerialNumber, "12");
|
||||
|
||||
Assert.Equal(1, session.LogContact().SentNumber);
|
||||
Assert.Equal("2", session.Entry.ValueOf(ExchangeSlot.SentNumber));
|
||||
}
|
||||
|
||||
/// The BARTG contest sends the time of the exchange, and logs the time it
|
||||
/// sent rather than the time the contact was logged.
|
||||
[Fact]
|
||||
@@ -152,12 +180,12 @@ public class OperatingPositionTests
|
||||
[Fact]
|
||||
public void SpaceStepsOverTheReportAndComesBackToTheCall()
|
||||
{
|
||||
// CQ WW's boxes are the call, the report and the zone
|
||||
// CQ WW's boxes are the call, the two reports and the zone
|
||||
OperatingPosition session = Session();
|
||||
|
||||
Assert.Equal(0, session.Entry.Focus);
|
||||
session.Entry.Advance();
|
||||
Assert.Equal(2, session.Entry.Focus);
|
||||
Assert.Equal(3, session.Entry.Focus);
|
||||
session.Entry.Advance();
|
||||
Assert.Equal(0, session.Entry.Focus);
|
||||
}
|
||||
@@ -166,7 +194,7 @@ public class OperatingPositionTests
|
||||
public void GoingBackStepsOverTheReportToo()
|
||||
{
|
||||
OperatingPosition session = Session();
|
||||
session.Entry.FocusOn(2);
|
||||
session.Entry.FocusOn(3);
|
||||
|
||||
session.Entry.Retreat();
|
||||
|
||||
@@ -388,8 +416,7 @@ public class OperatingPositionTests
|
||||
session.Entry.Call = "W3LPL";
|
||||
|
||||
Assert.True(session.FillFromHistory());
|
||||
Assert.Equal("MDC", session.Entry.ValueOf(ExchangeSlot.Section));
|
||||
Assert.Equal("56", session.Entry.ValueOf(ExchangeSlot.Check));
|
||||
Assert.Equal("56MDC", session.Entry.ValueOf(ExchangeSlot.Exchange1));
|
||||
}
|
||||
|
||||
/// What the other station actually sends beats what was published, so a box
|
||||
@@ -401,11 +428,11 @@ public class OperatingPositionTests
|
||||
new Sweepstakes(ModeCategory.Cw),
|
||||
"!!Order!!,Call,Sect\nW3LPL,MDC");
|
||||
session.Entry.Call = "W3LPL";
|
||||
session.Entry.Set(ExchangeSlot.Section, "EPA");
|
||||
session.Entry.Set(ExchangeSlot.Exchange1, "72A 74EPA");
|
||||
|
||||
session.FillFromHistory();
|
||||
|
||||
Assert.Equal("EPA", session.Entry.ValueOf(ExchangeSlot.Section));
|
||||
Assert.Equal("72A 74EPA", session.Entry.ValueOf(ExchangeSlot.Exchange1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -417,7 +444,7 @@ public class OperatingPositionTests
|
||||
session.Entry.Call = "JA1XYZ";
|
||||
|
||||
Assert.False(session.FillFromHistory());
|
||||
Assert.Equal("", session.Entry.ValueOf(ExchangeSlot.Section));
|
||||
Assert.Equal("", session.Entry.ValueOf(ExchangeSlot.Exchange1));
|
||||
}
|
||||
|
||||
/// CQ WW exchanges the CQ zone, so the CQ zone column is the one to use.
|
||||
@@ -445,7 +472,7 @@ public class OperatingPositionTests
|
||||
|
||||
session.FillFromHistory();
|
||||
|
||||
Assert.Equal("CT", session.Entry.ValueOf(ExchangeSlot.Section));
|
||||
Assert.Equal("00CT", session.Entry.ValueOf(ExchangeSlot.Exchange1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -485,9 +512,9 @@ public class OperatingPositionTests
|
||||
OperatingPosition session = Session(new CqWorldWide(ModeCategory.Digital));
|
||||
session.Entry.Call = "JA1XYZ";
|
||||
|
||||
// the boxes are the call, the report, the zone and the state
|
||||
// the boxes are the call, the two reports, the zone and the state
|
||||
session.MoveFocus(forward: true);
|
||||
Assert.Equal(2, session.Entry.Focus);
|
||||
Assert.Equal(3, session.Entry.Focus);
|
||||
session.MoveFocus(forward: true);
|
||||
Assert.Equal(0, session.Entry.Focus);
|
||||
}
|
||||
@@ -498,10 +525,10 @@ public class OperatingPositionTests
|
||||
OperatingPosition session = Session(new CqWorldWide(ModeCategory.Digital));
|
||||
session.Entry.Call = "K1ABC";
|
||||
|
||||
session.MoveFocus(forward: true);
|
||||
Assert.Equal(2, session.Entry.Focus);
|
||||
session.MoveFocus(forward: true);
|
||||
Assert.Equal(3, session.Entry.Focus);
|
||||
session.MoveFocus(forward: true);
|
||||
Assert.Equal(4, session.Entry.Focus);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -58,6 +58,35 @@ public class QsoEditorTests
|
||||
public void AContestWithSerialNumbersGetsASentNumberColumn() =>
|
||||
Assert.Contains(QsoField.SentNumber, Sweeps().Columns.Select(c => c.Field));
|
||||
|
||||
/// Sweepstakes types the whole exchange in one box and logs it in four
|
||||
/// columns, as N1MM does.
|
||||
[Fact]
|
||||
public void TheSweepstakesExchangeGetsAColumnPerPart()
|
||||
{
|
||||
IReadOnlyList<QsoField> fields = [.. Sweeps().Columns.Select(c => c.Field)];
|
||||
|
||||
Assert.Contains(QsoField.ReceivedNumber, fields);
|
||||
Assert.Contains(QsoField.Precedence, fields);
|
||||
Assert.Contains(QsoField.Check, fields);
|
||||
Assert.Contains(QsoField.Section, fields);
|
||||
Assert.DoesNotContain(QsoField.Exchange1, fields);
|
||||
}
|
||||
|
||||
/// A WAE row says whether it is a contact or QTC traffic in the exchange
|
||||
/// column — `QSO`, `SQTC` or `RQTC` — and N1MM's log has that column.
|
||||
[Fact]
|
||||
public void TheWaeLogHasAColumnForTheQtcDesignator()
|
||||
{
|
||||
QsoEditor editor = new(new Wae(ModeCategory.Cw), Me, CountryFile.Parse(Countries));
|
||||
|
||||
Assert.Equal(
|
||||
["Series", "QTC?"],
|
||||
editor.Columns
|
||||
.Where(c => c.Field is QsoField.Exchange1 or QsoField.MiscText)
|
||||
.Select(c => c.Label)
|
||||
.ToList());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChangingTheCallLooksTheCountryUpAgain()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user