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.
go-algorithms/numerical/fast_pow_test.go

24 lines
415 B
Go

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")
}
}