audio/internal/convert: bug fix: skip some tests on browsers

This commit is contained in:
Hajime Hoshi 2024-07-13 22:39:37 +09:00
parent 43f505b3a0
commit 96a07c1bf2

View File

@ -18,6 +18,7 @@ import (
"bytes"
"crypto/rand"
"io"
"runtime"
"testing"
"unsafe"
@ -35,6 +36,7 @@ func randInt16s(n int) []int16 {
func TestFloat32(t *testing.T) {
cases := []struct {
In []int16
SkipOnBrowserReason string
}{
{
In: nil,
@ -50,9 +52,13 @@ func TestFloat32(t *testing.T) {
},
{
In: randInt16s(65536),
SkipOnBrowserReason: "entropy is not enough on browser to generate random numbers",
},
}
for _, c := range cases {
if runtime.GOOS == "js" && c.SkipOnBrowserReason != "" {
t.Skip(c.SkipOnBrowserReason)
}
// Note that unsafe.SliceData is available as of Go 1.20.
var in, out []byte
if len(c.In) > 0 {