ina3221/ina3221_test.go
2023-08-20 07:57:49 +02:00

33 lines
523 B
Go

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)
}