Skip to content
Snippets Groups Projects
Commit 4a5464e3 authored by Sebastien Binet's avatar Sebastien Binet
Browse files

dif: more Readout test coverage

parent d0b786e0
No related branches found
No related tags found
No related merge requests found
...@@ -12,6 +12,7 @@ import ( ...@@ -12,6 +12,7 @@ import (
"github.com/go-daq/tdaq/log" "github.com/go-daq/tdaq/log"
"github.com/ziutek/ftdi" "github.com/ziutek/ftdi"
"golang.org/x/xerrors"
) )
func ftdiOpenTest(vid, pid uint16) (ftdiDevice, error) { func ftdiOpenTest(vid, pid uint16) (ftdiDevice, error) {
...@@ -24,6 +25,19 @@ func TestReadout(t *testing.T) { ...@@ -24,6 +25,19 @@ func TestReadout(t *testing.T) {
ftdiOpen = ftdiOpenImpl ftdiOpen = ftdiOpenImpl
}() }()
{
const name = "FT101xxx"
rdo, err := NewReadout(name, 0x6014, nil)
if err == nil {
rdo.close()
t.Fatalf("expected an error")
}
want := xerrors.Errorf("could not find DIF-id from %q: %s", name, xerrors.New("expected integer"))
if got, want := err.Error(), want.Error(); got != want {
t.Fatalf("invalid error:\ngot= %v\nwant=%v", got, want)
}
}
const ( const (
name = "FT101042" name = "FT101042"
prodID = 0x6014 prodID = 0x6014
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment