Compare commits
2 Commits
bb4e627657
...
6c54e8827e
Author | SHA1 | Date |
---|---|---|
0xAX | 6c54e8827e | 3 years ago |
julio.cesar | 90eda2d41d | 4 years ago |
@ -0,0 +1,23 @@
|
||||
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")
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package numerical
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestFastPow tests fastpow function
|
||||
func TestFastPow(t *testing.T) {
|
||||
|
||||
if FastPow(2, 10) != 1024 {
|
||||
t.Error("[Error] FastPow(2, 10) is wrong")
|
||||
}
|
||||
|
||||
if FastPow(1, 10) != 1 {
|
||||
t.Error("[Error] FastPow(1, 10) is wrong")
|
||||
}
|
||||
|
||||
if FastPow(0, 15) != 0 {
|
||||
t.Error("[Error] FastPow(0, 15) is wrong")
|
||||
}
|
||||
|
||||
if FastPow(10, 2) != 100 {
|
||||
t.Error("[Error] FastPow(0, 15) is wrong")
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue