algorithms/shuffle/shuffle_test.go

32 lines
581 B
Go
Raw Permalink Normal View History

2020-11-18 18:24:48 +00:00
package shuffle
import (
assertTest "github.com/stretchr/testify/assert"
"testing"
)
func TestShuffle(t *testing.T) {
assert := assertTest.New(t)
2020-11-18 18:40:58 +00:00
t.Run("should Shuffle string", func(t *testing.T) {
payload := "my payload to Shuffle"
2020-11-18 18:24:48 +00:00
2020-11-18 18:40:58 +00:00
assert.NotEqual(payload, Shuffle(payload))
2020-11-18 18:24:48 +00:00
})
2020-11-18 18:40:58 +00:00
t.Run("should Shuffle string", func(t *testing.T) {
2020-11-18 18:24:48 +00:00
payload := "a"
2020-11-18 18:40:58 +00:00
assert.Equal(payload, Shuffle(payload))
2020-11-18 18:24:48 +00:00
})
2020-11-18 18:40:58 +00:00
t.Run("should Shuffle string", func(t *testing.T) {
2020-11-18 18:24:48 +00:00
payload := "ab"
2020-11-18 18:40:58 +00:00
result := Shuffle(payload)
assert.Contains(result, "a")
assert.Contains(result, "b")
2020-11-18 18:24:48 +00:00
})
}