mirror of https://bitbucket.org/ausocean/av.git
input/gvctrl/gvctrl_test.go: fixed TestHeight
This commit is contained in:
parent
a5064e872c
commit
c01879d364
|
@ -179,34 +179,49 @@ func TestCodecOut(t *testing.T) {
|
|||
|
||||
func TestHeight(t *testing.T) {
|
||||
tests := []struct {
|
||||
s settings
|
||||
h int
|
||||
want settings
|
||||
err error
|
||||
}{
|
||||
{
|
||||
s: settings{ch: 2},
|
||||
h: 256,
|
||||
want: settings{res: "4480256"},
|
||||
want: settings{ch: 2, res: "4480256"},
|
||||
},
|
||||
{
|
||||
s: settings{ch: 2},
|
||||
h: 360,
|
||||
want: settings{res: "6400360"},
|
||||
want: settings{ch: 2, res: "6400360"},
|
||||
},
|
||||
{
|
||||
s: settings{ch: 2},
|
||||
h: 720,
|
||||
want: settings{res: "12800720"},
|
||||
want: settings{ch: 2, res: "12800720"},
|
||||
},
|
||||
{
|
||||
s: settings{ch: 2},
|
||||
h: 500,
|
||||
want: settings{},
|
||||
want: settings{ch: 2},
|
||||
err: errors.New(""),
|
||||
},
|
||||
{
|
||||
s: settings{ch: 1},
|
||||
h: 1080,
|
||||
want: settings{ch: 1, res: "192001080"},
|
||||
},
|
||||
{
|
||||
s: settings{ch: 1},
|
||||
h: 1000,
|
||||
want: settings{ch: 1},
|
||||
err: errors.New(""),
|
||||
},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
s := settings{}
|
||||
got, err := Height(test.h)(s)
|
||||
got, err := Height(test.h)(test.s)
|
||||
if test.err == nil && err != nil || test.err != nil && err == nil {
|
||||
t.Errorf("did not get expected error: %v", test.err)
|
||||
t.Errorf("did not get expected error: %v for test: %d", err, i)
|
||||
}
|
||||
|
||||
if got != test.want {
|
||||
|
|
Loading…
Reference in New Issue