2018-07-15 21:04:17 +02:00
|
|
|
package runtime
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestChannel(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
|
|
|
ChannelEU = true
|
2018-08-10 13:46:18 +02:00
|
|
|
assert.False(ChannelIs5GHz(9), "is 2.4 GHz in EU")
|
|
|
|
assert.True(ChannelIs5GHz(44), "is 5 GHz everywhere")
|
|
|
|
assert.False(ChannelIs5GHz(38), "is not 5 GHz in EU")
|
2018-07-15 21:04:17 +02:00
|
|
|
|
2018-08-10 13:46:18 +02:00
|
|
|
assert.NotNil(GetChannel(9), "is 2.4 GHz channel everywhere")
|
|
|
|
assert.NotNil(GetChannel(44), "is 5 GHz channel everywhere")
|
|
|
|
assert.Nil(GetChannel(38), "is not a 5 GHz channel in EU")
|
2018-07-15 21:04:17 +02:00
|
|
|
|
|
|
|
ChannelEU = false
|
2018-08-10 13:46:18 +02:00
|
|
|
assert.False(ChannelIs5GHz(9), "is 2.4 GHz in EU")
|
|
|
|
assert.True(ChannelIs5GHz(44), "is 5 GHz everywhere")
|
|
|
|
assert.True(ChannelIs5GHz(38), "is 5 GHz somewhere else")
|
2018-07-15 21:04:17 +02:00
|
|
|
|
2018-08-10 13:46:18 +02:00
|
|
|
assert.NotNil(GetChannel(9), "is 2.4 GHz channel everywhere")
|
|
|
|
assert.NotNil(GetChannel(44), "is 5 GHz channel everywhere")
|
|
|
|
assert.NotNil(GetChannel(38), "is 5 GHz channel somewhere else")
|
2018-07-15 21:04:17 +02:00
|
|
|
|
|
|
|
}
|