Check that optional interfaces are implemented (#159)

This commit is contained in:
andig 2020-05-17 13:11:40 +02:00 • committed by GitHub
parent fe334e8327
commit 5dc903f4ce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 77 additions and 0 deletions

20
charger/go-e-test.go Normal file
View file

@ -0,0 +1,20 @@
package charger
import (
"testing"
"github.com/andig/evcc/api"
)
// TestGoE tests interfaces
func TestGoE(t *testing.T) {
var wb api.Charger = NewGoE("foo")
if _, ok := wb.(api.MeterCurrent); !ok {
t.Error("missing MeterCurrents interface")
}
if _, ok := wb.(api.ChargeRater); !ok {
t.Error("missing ChargeRater interface")
}
}

23
charger/keba_test.go Normal file
View file

@ -0,0 +1,23 @@
package charger
import (
"testing"
"github.com/andig/evcc/api"
)
func TestKeba(t *testing.T) {
var wb api.Charger = NewKeba("foo", RFID{}, 0)
if _, ok := wb.(api.MeterEnergy); !ok {
t.Error("missing MeterEnergy interface")
}
if _, ok := wb.(api.MeterCurrent); !ok {
t.Error("missing MeterCurrents interface")
}
if _, ok := wb.(api.ChargeRater); !ok {
t.Error("missing ChargeRater interface")
}
}

View file

@ -0,0 +1,15 @@
package charger
import (
"testing"
"github.com/andig/evcc/api"
)
func TestNRGKickBLE(t *testing.T) {
var wb api.Charger = &NRGKickBLE{}
if _, ok := wb.(api.MeterCurrent); !ok {
t.Error("missing MeterCurrents interface")
}
}

View file

@ -0,0 +1,19 @@
package charger
import (
"testing"
"github.com/andig/evcc/api"
)
func TestNRGKickConnect(t *testing.T) {
var wb api.Charger = NewNRGKickConnect("foo", "bar", "baz")
if _, ok := wb.(api.MeterEnergy); !ok {
t.Error("missing MeterEnergy interface")
}
if _, ok := wb.(api.MeterCurrent); !ok {
t.Error("missing MeterCurrents interface")
}
}