You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
402 B
Go
24 lines
402 B
Go
package numerical
|
|
|
|
import "testing"
|
|
|
|
// Testfactorial tests factorial function
|
|
func Testfactorial(t *testing.T) {
|
|
|
|
if factorial(2) != 2 {
|
|
t.Error("[Error] factorial(2) is wrong")
|
|
}
|
|
|
|
if factorial(3) != 6 {
|
|
t.Error("[Error] factorial(3) is wrong")
|
|
}
|
|
|
|
if factorial(0) != 1 {
|
|
t.Error("[Error] factorial(0) is wrong")
|
|
}
|
|
|
|
if factorial(5) != 120 {
|
|
t.Error("[Error] factorial(5) is wrong")
|
|
}
|
|
}
|