MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / TestIterativePower

Function TestIterativePower

math/power/fastexponent_test.go:18–27  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16}
17
18func TestIterativePower(t *testing.T) {
19 for _, tc := range testCases {
20 t.Run(tc.name, func(t *testing.T) {
21 actual := IterativePower(tc.base, tc.power)
22 if actual != tc.expected {
23 t.Errorf("Expected %d to the power of %d to be: %d, but got: %d", tc.base, tc.power, tc.expected, actual)
24 }
25 })
26 }
27}
28
29func TestRecursivePower(t *testing.T) {
30 for _, tc := range testCases {

Callers

nothing calls this directly

Calls 1

IterativePowerFunction · 0.85

Tested by

no test coverage detected