mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta/meta_test.go: using table of tests for TestReadFrom
This commit is contained in:
parent
f96f761b2f
commit
66a2325dcb
|
@ -151,20 +151,28 @@ func TestEncode(t *testing.T) {
|
||||||
// from a string of metadata using the ReadFrom func.
|
// from a string of metadata using the ReadFrom func.
|
||||||
func TestReadFrom(t *testing.T) {
|
func TestReadFrom(t *testing.T) {
|
||||||
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
tstMeta := append([]byte{0x00, 0x10, 0x00, 0x12}, "loc=a,b,c\tts=12345"...)
|
||||||
got, err := ReadFrom([]byte(tstMeta), "loc")
|
|
||||||
if err != nil {
|
tests := []struct {
|
||||||
t.Errorf("Unexpected err: %v\n", err)
|
key string
|
||||||
}
|
want string
|
||||||
want := "a,b,c"
|
}{
|
||||||
if got != want {
|
{
|
||||||
t.Errorf("Did not get expected out. \nGot : %v, \nwant: %v\n", got, want)
|
"loc",
|
||||||
|
"a,b,c",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ts",
|
||||||
|
"12345",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if got, err = ReadFrom([]byte(tstMeta), "ts"); err != nil {
|
for _, test := range tests {
|
||||||
t.Errorf("Unexpected err: %v\n", err)
|
got, err := ReadFrom([]byte(tstMeta), test.key)
|
||||||
}
|
if err != nil {
|
||||||
want = "12345"
|
t.Errorf("Unexpected err: %v\n", err)
|
||||||
if got != want {
|
}
|
||||||
t.Errorf("Did not get expected out. \nGot : %v, \nwant: %v\n", got, want)
|
if got != test.want {
|
||||||
|
t.Errorf("Did not get expected out. \nGot : %v, \nwant: %v\n", got, test.want)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue