-
Notifications
You must be signed in to change notification settings - Fork 2
/
util_test.go
41 lines (36 loc) · 963 Bytes
/
util_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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")
s1 := []float64{3.6, 8.7, 1.8, 18.2}
s2 := make([]float64, len(s1))
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) {
assert.Equal(t, float64(-34), res)
})
res = convertLevel(-0.02)
t.Run("Should be equal", func(t *testing.T) {
assert.Equal(t, float64(-200), res)
})
}