feat: add unit test

This commit is contained in:
2019-09-20 01:24:50 +02:00
parent ced985da52
commit 779cd1da6e
7 changed files with 270 additions and 6 deletions

View File

@@ -3,7 +3,7 @@ package hamster_tycoon
import (
"errors"
"fmt"
"math/rand"
"hamster-tycoon/randomizer"
)
const (
@@ -56,7 +56,7 @@ func (h *Hamster) Fuck(another *Hamster) (bool, error) {
return false, errors.New("can't fuck together")
}
if h.Age <= GestationMinAge || another.Age <= GestationMinAge {
if h.Age < GestationMinAge || another.Age < GestationMinAge {
return false, errors.New("one of the hamster is too young")
}
@@ -128,5 +128,5 @@ func randSexe() string {
}
func randNumber(min int, max int) int {
return min + rand.Intn(max-min)
return min + randomizer.Rand(max-min)
}