mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/convert: better tests for Seek
This commit is contained in:
parent
e43ab06f35
commit
f6c9c88f78
@ -92,7 +92,9 @@ func TestFloat32(t *testing.T) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if seek {
|
if seek {
|
||||||
if _, err := r.Seek(0, io.SeekCurrent); err != nil {
|
// Shifting by incomplete bytes should not affect the result.
|
||||||
|
for i := 0; i < 4; i++ {
|
||||||
|
if _, err := r.Seek(int64(i), io.SeekCurrent); err != nil {
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -100,6 +102,7 @@ func TestFloat32(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
want := out
|
want := out
|
||||||
if !bytes.Equal(got, want) {
|
if !bytes.Equal(got, want) {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
|
@ -105,7 +105,7 @@ func TestResampling(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
// Shifting by incomplete bytes should not affect the result.
|
// Shifting by incomplete bytes should not affect the result.
|
||||||
for i := 0; i < bitDepthInBytes*2-1; i++ {
|
for i := 0; i < bitDepthInBytes*2; i++ {
|
||||||
pos, err := outS.Seek(int64(i), io.SeekCurrent)
|
pos, err := outS.Seek(int64(i), io.SeekCurrent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -87,13 +87,16 @@ func TestStereoF32(t *testing.T) {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
if _, err := s.Seek(0, io.SeekCurrent); err != nil {
|
// Shifting by incomplete bytes should not affect the result.
|
||||||
|
for i := 0; i < 4*2; i++ {
|
||||||
|
if _, err := s.Seek(int64(i), io.SeekCurrent); err != nil {
|
||||||
if err != io.EOF {
|
if err != io.EOF {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
want := outBytes
|
want := outBytes
|
||||||
if !bytes.Equal(got, want) {
|
if !bytes.Equal(got, want) {
|
||||||
t.Errorf("got: %v, want: %v", got, want)
|
t.Errorf("got: %v, want: %v", got, want)
|
||||||
|
Loading…
Reference in New Issue
Block a user