package system import ( "testing" ) // TestGetInfo ensures that the array can be populated with device info. func TestGetInfo(t *testing.T) { if err := getInfo(); err != nil { t.Fatalf(`getInfo() failed %v`, err) } } // 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) } }