-
Notifications
You must be signed in to change notification settings - Fork 12
/
pcopy_getlikefavorited_test.go
198 lines (171 loc) · 5.33 KB
/
pcopy_getlikefavorited_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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
// Copyright [2020-2023] [guonaihong]
package pcopy
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
type CommentModule int32
const (
CommentModule_CommentModuleUndefined CommentModule = 0
CommentModule_CommentModuleDiary CommentModule = 1
CommentModule_CommentModuleHotPot CommentModule = 2
)
type LikeType int32
const (
LikeType_LIKE LikeType = 0
LikeType_COLLECT LikeType = 1
)
type GetMessageLikeFavoritedResp struct {
Code int32
Message string
Data *GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData
}
type MessageWhoAndTime struct {
HeadPic string
Nickname string
Time string
DID uint64
Seq int64
}
type CommentType int32
const (
CommentType_DIARY CommentType = 0
CommentType_COMMENT CommentType = 1
)
type MessageResourceType int32
const (
MessageResourceType_MessageResourceTypeLike MessageResourceType = 2
MessageResourceType_MessageResourceTypeFavorited MessageResourceType = 3
MessageResourceType_MessageesourceTypeText MessageResourceType = 4
MessageResourceType_MessageResourceTypeImage MessageResourceType = 5
MessageResourceType_MessageResourceTypeVideo MessageResourceType = 6
)
type GetMessageLikeFavoritedRespItem struct {
Info *MessageWhoAndTime
LikeType LikeType
CommentType CommentType
ResourceType MessageResourceType
PostID uint64
RefMessage string
RefMessageID uint64
ParentCid uint64
CommentModule CommentModule
ArticleThumbnail string
}
type GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData struct {
Items []*GetMessageLikeFavoritedRespItem
}
var local_GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData = GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData{
Items: []*GetMessageLikeFavoritedRespItem{
{
Info: &MessageWhoAndTime{
HeadPic: "headpic",
Nickname: "nickname",
Time: "time",
DID: 1,
Seq: 1,
},
LikeType: LikeType_COLLECT,
CommentType: CommentType_COMMENT,
ResourceType: MessageResourceType_MessageResourceTypeLike,
PostID: 1,
RefMessage: "refmessage",
RefMessageID: 1,
ParentCid: 1,
CommentModule: CommentModule_CommentModuleDiary,
ArticleThumbnail: "articlethumbnail",
},
{
Info: &MessageWhoAndTime{
HeadPic: "headpic2",
Nickname: "nickname2",
Time: "time2",
DID: 2,
Seq: 2,
},
LikeType: LikeType_COLLECT,
CommentType: CommentType_COMMENT,
ResourceType: MessageResourceType_MessageResourceTypeLike,
PostID: 2,
RefMessage: "refmessage",
RefMessageID: 2,
ParentCid: 2,
CommentModule: CommentModule_CommentModuleDiary,
ArticleThumbnail: "articlethumbnail",
},
{
Info: &MessageWhoAndTime{
HeadPic: "headpic2",
Nickname: "nickname2",
Time: "time2",
DID: 2,
Seq: 2,
},
LikeType: LikeType_COLLECT,
CommentType: CommentType_COMMENT,
ResourceType: MessageResourceType_MessageResourceTypeLike,
PostID: 2,
RefMessage: "refmessage",
RefMessageID: 2,
ParentCid: 2,
CommentModule: CommentModule_CommentModuleDiary,
ArticleThumbnail: "articlethumbnail",
},
{
Info: &MessageWhoAndTime{
HeadPic: "headpic2",
Nickname: "nickname2",
Time: "time2",
DID: 2,
Seq: 2,
},
LikeType: LikeType_COLLECT,
CommentType: CommentType_COMMENT,
ResourceType: MessageResourceType_MessageResourceTypeLike,
PostID: 2,
RefMessage: "refmessage",
RefMessageID: 2,
ParentCid: 2,
CommentModule: CommentModule_CommentModuleDiary,
ArticleThumbnail: "articlethumbnail",
},
{
Info: &MessageWhoAndTime{
HeadPic: "headpic2",
Nickname: "nickname2",
Time: "time2",
DID: 2,
Seq: 2,
},
LikeType: LikeType_COLLECT,
CommentType: CommentType_COMMENT,
ResourceType: MessageResourceType_MessageResourceTypeLike,
PostID: 2,
RefMessage: "refmessage",
RefMessageID: 2,
ParentCid: 2,
CommentModule: CommentModule_CommentModuleDiary,
ArticleThumbnail: "articlethumbnail",
},
},
}
func Test_GetMessageLikeFavorited_1(t *testing.T) {
err := Preheat(&GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData{}, &GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData{})
assert.NoError(t, err)
var dst GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData
err = Copy(&dst, &local_GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData, WithUsePreheat())
assert.NoError(t, err)
fmt.Printf("%d\n", len(dst.Items))
assert.Equal(t, local_GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData, dst)
}
// 左边传参数是个二级指针
func Test_GetMessageLikeFavorited_2(t *testing.T) {
err := Preheat(&GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData{}, &GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData{})
assert.NoError(t, err)
var resp GetMessageLikeFavoritedResp
// var dst GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData
err = Copy(&resp.Data, &local_GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData, WithUsePreheat())
assert.NoError(t, err)
assert.Equal(t, local_GetMessageLikeFavoritedResp_GetMessageLikeFavoritedRespData, *resp.Data)
}