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 19a7026

Browse files
Create utf-8-validation_test.go
1 parent 369ce14 commit 19a7026

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎utf-8-validation_test.go‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package leetcode_solutions_golang
2+
3+
import "testing"
4+
5+
func Test_validUtf8(t *testing.T) {
6+
type args struct {
7+
data []int
8+
}
9+
tests := []struct {
10+
name string
11+
args args
12+
want bool
13+
}{
14+
{
15+
name: "test case 1",
16+
args: args{
17+
data: []int{197, 130, 1},
18+
},
19+
want: true,
20+
},
21+
{
22+
name: "test case 2",
23+
args: args{
24+
data: []int{235, 140, 4},
25+
},
26+
want: false,
27+
},
28+
}
29+
for _, tt := range tests {
30+
t.Run(tt.name, func(t *testing.T) {
31+
if got := validUtf8(tt.args.data); got != tt.want {
32+
t.Errorf("validUtf8() = %v, want %v", got, tt.want)
33+
}
34+
})
35+
}
36+
}

0 commit comments

Comments
(0)

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