For sh/wwv, only the first record under the header is used, since the table lists the newest first. The date, time, forecast and logger are dropped, and the status bar reads "SFI 140 A 5 K 2". The line the node sent is the tool tip. Announcement lines give the same three values. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
namespace Nonemm.Spotting.Tests;
|
|
|
|
public class SolarReaderTests
|
|
{
|
|
[Theory]
|
|
[InlineData("WWV de VE7CC <18Z> : SFI=140, A=5, K=2, No Storms -> No Storms\a\a", "SFI 140 A 5 K 2")]
|
|
[InlineData("WCY de DK0WCY-1 <19> : K=2 expK=2 A=5 R=0 SFI=140 SA=qui", "SFI 140 A 5 K 2")]
|
|
[InlineData("WWV: SFI=140 A=5 K=2", "SFI 140 A 5 K 2")]
|
|
public void AnnouncementLinesShowTheirIndices(string line, string text)
|
|
{
|
|
SolarReport? report = new SolarReader().Read(line);
|
|
|
|
Assert.Equal(text, report?.Text);
|
|
Assert.Equal(line.TrimEnd('\a'), report?.Original);
|
|
}
|
|
|
|
[Fact]
|
|
public void TheNewestRecordUnderAShWwvHeaderIsShownWithoutDateOrTime()
|
|
{
|
|
SolarReader reader = new();
|
|
|
|
Assert.Null(reader.Read(" Date Hour SFI A K Forecast Logger"));
|
|
SolarReport? newest = reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC");
|
|
|
|
Assert.Equal("SFI 140 A 5 K 2", newest?.Text);
|
|
Assert.Equal("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC", newest?.Original);
|
|
}
|
|
|
|
[Fact]
|
|
public void TheOlderRecordsUnderTheHeaderAreIgnored()
|
|
{
|
|
SolarReader reader = new();
|
|
reader.Read("Date Hour SFI A K Forecast Logger");
|
|
reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC");
|
|
|
|
Assert.Null(reader.Read("24-Oct-2026 0900Z 138 6 3 No Storms -> No Storms VE7CC"));
|
|
}
|
|
|
|
[Fact]
|
|
public void AnAnnouncementWithoutIndicesIsNotSolarWeather() =>
|
|
Assert.Null(new SolarReader().Read("WWV de VE7CC <18Z> : no data"));
|
|
|
|
[Fact]
|
|
public void ASpotCancelsTheHeader()
|
|
{
|
|
SolarReader reader = new();
|
|
reader.Read("Date Hour SFI A K Forecast Logger");
|
|
reader.Read("DX de K1TTT: 14025.0 JA1XYZ CW 1205Z");
|
|
|
|
Assert.Null(reader.Read("24-Oct-2026 1200Z 140 5 2 No Storms -> No Storms VE7CC"));
|
|
}
|
|
|
|
[Fact]
|
|
public void OrdinaryLinesAreNotSolarWeather() =>
|
|
Assert.Null(new SolarReader().Read("DX de K1TTT: 14025.0 JA1XYZ CW 26 dB 1205Z"));
|
|
}
|