mirror of
https://github.com/0xAX/go-algorithms
synced 2024-11-09 19:11:08 +00:00
Compare commits
No commits in common. "6c54e8827ed32d216fbcce16d24922e5d99edcd0" and "bb4e627657a96359cb028c78a163ba389187c365" have entirely different histories.
6c54e8827e
...
bb4e627657
@ -1,23 +0,0 @@
|
|||||||
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")
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
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
Block a user