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/bin_pow_test.go

20 lines
356 B
Go

package numerical
import "testing"
// TestBinPow tests binpow function
func TestBinPow(t *testing.T) {
if BinPow(2, 10, 121323) != 1024 {
t.Error("[Error] BinPow(2, 10) is wrong")
}
if BinPow(1, 10, 121323) != 1 {
t.Error("[Error] BinPow(1, 10) is wrong")
}
if BinPow(0, 123123, 2) != 0 {
t.Error("[Error] BinPow(0, 123123) is wrong")
}
}