go-onerng/onerng_test.go
Dave Henderson 6f55b00772
Adding read command
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
2018-08-12 14:45:26 -04:00

35 lines
720 B
Go

package onerng
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
func TestNoiseCommand(t *testing.T) {
fmt.Println(DisableWhitener)
fmt.Println(EnableRF)
fmt.Println(DisableAvalanche)
fmt.Println(Default)
fmt.Println(Silent)
testdata := []struct {
flags ReadMode
cmd string
}{
{Default, "cmd0\n"},
{DisableWhitener, "cmd1\n"},
{EnableRF, "cmd2\n"},
{EnableRF | DisableWhitener, "cmd3\n"},
{DisableAvalanche, "cmd4\n"},
{DisableAvalanche | DisableWhitener, "cmd5\n"},
{DisableAvalanche | EnableRF, "cmd6\n"},
{DisableAvalanche | EnableRF | DisableWhitener, "cmd7\n"},
}
for _, d := range testdata {
assert.Equal(t, d.cmd, NoiseCommand(d.flags), d.cmd, d.flags)
}
}