chore: release v0.19.3

This commit is contained in:
2026-07-09 17:32:13 +02:00
parent 19c2de5f61
commit 1f74e4d234
11 changed files with 482 additions and 9 deletions
+48
View File
@@ -0,0 +1,48 @@
package solar
import "testing"
// A trimmed sample of the real N0NBH hamqsl.com solarxml.php document.
const sampleXML = `<?xml version="1.0"?>
<solar>
<solardata>
<source url="http://www.hamqsl.com/solar.html">N0NBH</source>
<updated>08 Jul 2025 2100 GMT</updated>
<solarflux>170</solarflux>
<aindex>5</aindex>
<kindex>2</kindex>
<xray>C1.5</xray>
<sunspots>150</sunspots>
<geomagfield>QUIET</geomagfield>
<muf>18.5</muf>
</solardata>
</solar>`
func TestParseSolar(t *testing.T) {
d, err := parseSolar([]byte(sampleXML))
if err != nil {
t.Fatalf("parse: %v", err)
}
if !d.OK {
t.Fatalf("expected OK")
}
checks := map[string]string{
"SFI": d.SFI, "SSN": d.SSN, "A": d.AIndex, "K": d.KIndex,
"XRay": d.XRay, "Geomag": d.GeomagField, "Source": d.Source,
}
want := map[string]string{
"SFI": "170", "SSN": "150", "A": "5", "K": "2",
"XRay": "C1.5", "Geomag": "QUIET", "Source": "N0NBH",
}
for k, got := range checks {
if got != want[k] {
t.Errorf("%s = %q, want %q", k, got, want[k])
}
}
}
func TestParseSolarBadXML(t *testing.T) {
if _, err := parseSolar([]byte("not xml")); err == nil {
t.Fatalf("expected an error for non-XML input")
}
}