You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
Go
42 lines
1.1 KiB
Go
1 year ago
|
package system
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
1 year ago
|
// TestGetInfo ensures that the array can be populated with device info.
|
||
1 year ago
|
func TestGetInfo(t *testing.T) {
|
||
1 year ago
|
if err := getInfo(); err != nil {
|
||
|
t.Fatalf(`getInfo() failed %v`, err)
|
||
1 year ago
|
}
|
||
|
}
|
||
1 year ago
|
|
||
|
// TestGetIP tests that the IP is returned without error and not empty.
|
||
|
func TestGetIP(t *testing.T) {
|
||
|
if ip, err := GetIP(); err != nil || ip == "" {
|
||
|
t.Fatalf(`GetIP() failed, got %s, err: %v`, ip, err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TestGetID tests that the ID is returned without error and not empty.
|
||
|
func TestGetID(t *testing.T) {
|
||
|
if id, err := GetID(); err != nil || id == 0 {
|
||
|
t.Fatalf(`GetID() failed, got %d %v`, id, err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TestGetModel tests that the Model is returned without error and not empty.
|
||
|
func TestGetModel(t *testing.T) {
|
||
|
if model, err := GetModel(); err != nil || model == "" {
|
||
|
t.Fatalf(`GetModel() failed, got %s %v`, model, err)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TestGetModel tests that the correct error is thrown as the bus does not exist on the test rig.
|
||
|
func TestGetBus(t *testing.T) {
|
||
|
if bus, err := GetBus(); err != ErrBusNotFound {
|
||
|
t.Fatalf(`GetBus() should fail, got %d %v`, bus, err)
|
||
|
}
|
||
|
|
||
|
}
|