-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrandomize_test.go
49 lines (47 loc) · 939 Bytes
/
randomize_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package testcraft
import (
"database/sql"
"testing"
"time"
)
func Test_randomize(t *testing.T) {
type Book struct {
Title string
}
type alias string
type User struct {
Name2 string
Name *string
Books []string
BookPtr []*string
Books2 []Book
Books2Ptr []*Book
Books3 Book
Books3Ptr *Book
Alias alias
SqlVal sql.NullBool
t time.Time
UpdatedAt *time.Time
}
type args[T any] struct {
f T
valuer Valuer
}
type testCase[T any] struct {
name string
args args[T]
wantErr bool
}
tests := []testCase[User]{
{name: "string", args: args[User]{f: User{}, valuer: defaultValuer()}, wantErr: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
_, err := randomize[User](tt.args.f, tt.args.valuer)
if (err != nil) != tt.wantErr {
t.Errorf("randomize() error = %v, wantErr %v", err, tt.wantErr)
return
}
})
}
}