Added tests for sunrise

This commit is contained in:
Winni Neessen 2023-05-30 15:57:16 +02:00
parent fe800b7632
commit e2a301c2a5
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -143,6 +143,18 @@ func TestAstronomicalInfo_SunsetByDateString(t *testing.T) {
t.Errorf("SunsetByTime failed, expected no entry, but got: %s",
ai.SunsetByTime(ti).Value().String())
}
if len(ai.SunsetAll()) != 14 {
t.Errorf("SunsetByTime failed, expected 14 entired, but got: %d", len(ai.SunsetAll()))
return
}
if ai.SunsetAll()[0].DateTime().Format("2006-01-02") != "2023-05-28" {
t.Errorf("SunsetByTime failed, expected first entry to be: %s, got: %s", "2023-05-28",
ai.SunsetAll()[0].DateTime().Format("2006-01-02"))
}
if ai.SunsetAll()[13].DateTime().Format("2006-01-02") != "2023-06-10" {
t.Errorf("SunsetByTime failed, expected first entry to be: %s, got: %s", "2023-06-10",
ai.SunsetAll()[13].DateTime().Format("2006-01-02"))
}
}
func TestAstronomicalInfo_SunriseByDateString(t *testing.T) {
@ -194,4 +206,16 @@ func TestAstronomicalInfo_SunriseByDateString(t *testing.T) {
t.Errorf("SunriseByTime failed, expected no entry, but got: %s",
ai.SunriseByTime(ti).Value().String())
}
if len(ai.SunriseAll()) != 14 {
t.Errorf("SunriseByTime failed, expected 14 entired, but got: %d", len(ai.SunriseAll()))
return
}
if ai.SunriseAll()[0].DateTime().Format("2006-01-02") != "2023-05-28" {
t.Errorf("SunriseByTime failed, expected first entry to be: %s, got: %s", "2023-05-28",
ai.SunriseAll()[0].DateTime().Format("2006-01-02"))
}
if ai.SunriseAll()[13].DateTime().Format("2006-01-02") != "2023-06-10" {
t.Errorf("SunriseByTime failed, expected first entry to be: %s, got: %s", "2023-06-10",
ai.SunriseAll()[13].DateTime().Format("2006-01-02"))
}
}