feat: add unit test
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user