Add test for zero input in randNum

This commit introduces a new test case in random_test.go to ensure that the randNum function returns zero when given an input of zero. This helps validate the correctness of edge case handling in the random number generation logic.
This commit is contained in:
Winni Neessen 2024-09-20 22:06:11 +02:00
parent 0b9a215e7d
commit 3f0ac027e2
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -62,3 +62,10 @@ func TestRandomNum(t *testing.T) {
}) })
} }
} }
func TestRandomNumZero(t *testing.T) {
rn := randNum(0)
if rn != 0 {
t.Errorf("random number generation failed: %d is not zero", rn)
}
}