2022-07-10 23:08:14 +01:00
|
|
|
package voicemeeter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestAllTrue(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
|
|
|
s := []bool{true, true, true, true, true, true}
|
|
|
|
t.Run("Should return true", func(t *testing.T) {
|
|
|
|
assert.True(t, allTrue(s, len(s)))
|
|
|
|
})
|
|
|
|
s = []bool{true, true, true, true, false, true}
|
|
|
|
t.Run("Should return false", func(t *testing.T) {
|
|
|
|
assert.False(t, allTrue(s, len(s)))
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestUpdate(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
2022-09-14 00:58:05 +01:00
|
|
|
s1 := []float64{3.6, 8.7, 1.8, 18.2}
|
|
|
|
s2 := make([]float64, len(s1))
|
2022-07-10 23:08:14 +01:00
|
|
|
update(s2, s1, len(s1))
|
|
|
|
t.Run("Should return true", func(t *testing.T) {
|
|
|
|
assert.Equal(t, s1, s2)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestConvertLevel(t *testing.T) {
|
|
|
|
//t.Skip("skipping test")
|
|
|
|
res := convertLevel(0.02)
|
|
|
|
t.Run("Should be equal", func(t *testing.T) {
|
2022-09-14 00:58:05 +01:00
|
|
|
assert.Equal(t, float64(-34), res)
|
2022-07-10 23:08:14 +01:00
|
|
|
})
|
|
|
|
res = convertLevel(-0.02)
|
|
|
|
t.Run("Should be equal", func(t *testing.T) {
|
2022-09-14 00:58:05 +01:00
|
|
|
assert.Equal(t, float64(-200), res)
|
2022-07-10 23:08:14 +01:00
|
|
|
})
|
|
|
|
}
|