improve utils tests to 100% coverage

This commit is contained in:
Lucas Clemente
2016-05-28 08:12:04 +02:00
parent a4773eb5ff
commit 576253ba71
5 changed files with 56 additions and 19 deletions

View File

@@ -167,13 +167,7 @@ func WriteUint16(b *bytes.Buffer, i uint16) {
func RandomBit() (bool, error) {
b := make([]byte, 1)
_, err := rand.Read(b)
if err != nil {
return false, err
}
if uint8(b[0])%2 == 0 {
return false, nil
}
return true, nil
return uint8(b[0])%2 == 0, err
}
// Uint32Slice attaches the methods of sort.Interface to []uint32, sorting in increasing order.