Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 937d10b

Browse files
Create powx-n_test.go
1 parent d5e4637 commit 937d10b

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

‎powx-n_test.go‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package leetcode_solutions_golang
2+
3+
import "testing"
4+
5+
func Test_myPow(t *testing.T) {
6+
type args struct {
7+
x float64
8+
n int
9+
}
10+
tests := []struct {
11+
name string
12+
args args
13+
want float64
14+
}{
15+
{
16+
name: "test case 1",
17+
args: args{
18+
x: 2.00000,
19+
n: 10,
20+
},
21+
want: 1024.00000,
22+
},
23+
}
24+
for _, tt := range tests {
25+
t.Run(tt.name, func(t *testing.T) {
26+
if got := myPow(tt.args.x, tt.args.n); got != tt.want {
27+
t.Errorf("myPow() = %v, want %v", got, tt.want)
28+
}
29+
})
30+
}
31+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /