surrealpatch/util/rand/rand_test.go

37 lines
911 B
Go
Raw Normal View History

2016-03-15 12:17:21 +00:00
// Copyright © 2016 Abcum Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
2016-05-17 21:35:36 +00:00
package rand
2016-03-15 12:17:21 +00:00
import (
2016-05-23 13:08:22 +00:00
"fmt"
2016-03-15 12:17:21 +00:00
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func TestNew(t *testing.T) {
2016-05-23 13:08:22 +00:00
for i := 0; i < 100; i++ {
2016-03-15 12:17:21 +00:00
2016-05-23 13:08:22 +00:00
Convey(fmt.Sprintf("Random string of length %d", i), t, func() {
2016-03-15 12:17:21 +00:00
Convey("Should be of correct length", func() {
2016-05-23 13:08:22 +00:00
So(New(i), ShouldHaveLength, i)
2016-03-15 12:17:21 +00:00
})
})
}
}