mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
audio/internal/convert: bug fix: skip tests on browsers correctly
This commit is contained in:
parent
bf3ded2a55
commit
03ca5c3b26
@ -34,11 +34,11 @@ func randInt16s(n int) []int16 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFloat32(t *testing.T) {
|
func TestFloat32(t *testing.T) {
|
||||||
cases := []struct {
|
type testCase struct {
|
||||||
Name string
|
Name string
|
||||||
In []int16
|
In []int16
|
||||||
SkipOnBrowserReason string
|
}
|
||||||
}{
|
cases := []testCase{
|
||||||
{
|
{
|
||||||
Name: "empty",
|
Name: "empty",
|
||||||
In: nil,
|
In: nil,
|
||||||
@ -55,18 +55,17 @@ func TestFloat32(t *testing.T) {
|
|||||||
Name: "random 256 values",
|
Name: "random 256 values",
|
||||||
In: randInt16s(256),
|
In: randInt16s(256),
|
||||||
},
|
},
|
||||||
{
|
}
|
||||||
Name: "random 65536 values",
|
// On browsers, entropy might not be enough.
|
||||||
In: randInt16s(65536),
|
if runtime.GOOS != "js" {
|
||||||
SkipOnBrowserReason: "entropy is not enough on browser to generate random numbers",
|
cases = append(cases, testCase{
|
||||||
},
|
Name: "random 65536 values",
|
||||||
|
In: randInt16s(65536),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
for _, c := range cases {
|
for _, c := range cases {
|
||||||
c := c
|
c := c
|
||||||
t.Run(c.Name, func(t *testing.T) {
|
t.Run(c.Name, func(t *testing.T) {
|
||||||
if runtime.GOOS == "js" && c.SkipOnBrowserReason != "" {
|
|
||||||
t.Skip(c.SkipOnBrowserReason)
|
|
||||||
}
|
|
||||||
// Note that unsafe.SliceData is available as of Go 1.20.
|
// Note that unsafe.SliceData is available as of Go 1.20.
|
||||||
var in, out []byte
|
var in, out []byte
|
||||||
if len(c.In) > 0 {
|
if len(c.In) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user