ina3221/ina3221_test.go

33 lines
523 B
Go
Raw Normal View History

2023-08-20 05:57:49 +00:00
package ina3221
import (
"testing"
"gotest.tools/v3/assert"
)
const (
i2c_slave_addr uint16 = 0x40
manufacturer_id uint16 = 0x5449
)
func TestMain(t *testing.T) {
err := start(i2c_slave_addr)
assert.NilError(t, err)
var id uint16
id, err = ManufacturerID()
assert.NilError(t, err)
assert.Assert(t, id == manufacturer_id)
for i := 1; i < 4; i++ {
_, err = Current(Channel(i))
assert.NilError(t, err)
_, err = Voltage(Channel(i))
assert.NilError(t, err)
}
err = stop()
assert.NilError(t, err)
}