contribute_test.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. package space
  2. import (
  3. "context"
  4. "reflect"
  5. "testing"
  6. "time"
  7. "go-common/app/interface/main/app-interface/model"
  8. "go-common/app/interface/main/app-interface/model/space"
  9. )
  10. func TestService_Contribute(t *testing.T) {
  11. type args struct {
  12. c context.Context
  13. plat int8
  14. build int
  15. vmid int64
  16. pn int
  17. ps int
  18. now time.Time
  19. }
  20. tests := []struct {
  21. name string
  22. s *Service
  23. args args
  24. wantRes *space.Contributes
  25. wantErr bool
  26. }{
  27. // TODO: Add test cases.
  28. }
  29. for _, tt := range tests {
  30. t.Run(tt.name, func(t *testing.T) {
  31. gotRes, err := tt.s.Contribute(tt.args.c, tt.args.plat, tt.args.build, tt.args.vmid, tt.args.pn, tt.args.ps, tt.args.now)
  32. if (err != nil) != tt.wantErr {
  33. t.Errorf("Service.Contribute() error = %v, wantErr %v", err, tt.wantErr)
  34. return
  35. }
  36. if !reflect.DeepEqual(gotRes, tt.wantRes) {
  37. t.Errorf("Service.Contribute() = %v, want %v", gotRes, tt.wantRes)
  38. }
  39. })
  40. }
  41. }
  42. func TestService_Contribution(t *testing.T) {
  43. type args struct {
  44. c context.Context
  45. plat int8
  46. build int
  47. vmid int64
  48. cursor *model.Cursor
  49. now time.Time
  50. }
  51. tests := []struct {
  52. name string
  53. s *Service
  54. args args
  55. wantRes *space.Contributes
  56. wantErr bool
  57. }{
  58. // TODO: Add test cases.
  59. }
  60. for _, tt := range tests {
  61. t.Run(tt.name, func(t *testing.T) {
  62. gotRes, err := tt.s.Contribution(tt.args.c, tt.args.plat, tt.args.build, tt.args.vmid, tt.args.cursor, tt.args.now)
  63. if (err != nil) != tt.wantErr {
  64. t.Errorf("Service.Contribution() error = %v, wantErr %v", err, tt.wantErr)
  65. return
  66. }
  67. if !reflect.DeepEqual(gotRes, tt.wantRes) {
  68. t.Errorf("Service.Contribution() = %v, want %v", gotRes, tt.wantRes)
  69. }
  70. })
  71. }
  72. }
  73. func TestService_firstContribute(t *testing.T) {
  74. type args struct {
  75. c context.Context
  76. vmid int64
  77. size int
  78. now time.Time
  79. }
  80. tests := []struct {
  81. name string
  82. s *Service
  83. args args
  84. wantRes *space.Contributes
  85. wantErr bool
  86. }{
  87. // TODO: Add test cases.
  88. }
  89. for _, tt := range tests {
  90. t.Run(tt.name, func(t *testing.T) {
  91. gotRes, err := tt.s.firstContribute(tt.args.c, tt.args.vmid, tt.args.size, tt.args.now)
  92. if (err != nil) != tt.wantErr {
  93. t.Errorf("Service.firstContribute() error = %v, wantErr %v", err, tt.wantErr)
  94. return
  95. }
  96. if !reflect.DeepEqual(gotRes, tt.wantRes) {
  97. t.Errorf("Service.firstContribute() = %v, want %v", gotRes, tt.wantRes)
  98. }
  99. })
  100. }
  101. }
  102. func TestService_dealContribute(t *testing.T) {
  103. type args struct {
  104. c context.Context
  105. plat int8
  106. build int
  107. vmid int64
  108. attrs *space.Attrs
  109. items []*space.Item
  110. now time.Time
  111. }
  112. tests := []struct {
  113. name string
  114. s *Service
  115. args args
  116. wantRes *space.Contributes
  117. wantErr bool
  118. }{
  119. // TODO: Add test cases.
  120. }
  121. for _, tt := range tests {
  122. t.Run(tt.name, func(t *testing.T) {
  123. gotRes, err := tt.s.dealContribute(tt.args.c, tt.args.plat, tt.args.build, tt.args.vmid, tt.args.attrs, tt.args.items, tt.args.now)
  124. if (err != nil) != tt.wantErr {
  125. t.Errorf("Service.dealContribute() error = %v, wantErr %v", err, tt.wantErr)
  126. return
  127. }
  128. if !reflect.DeepEqual(gotRes, tt.wantRes) {
  129. t.Errorf("Service.dealContribute() = %v, want %v", gotRes, tt.wantRes)
  130. }
  131. })
  132. }
  133. }
  134. func TestService_Clip(t *testing.T) {
  135. type args struct {
  136. c context.Context
  137. vmid int64
  138. pos int
  139. size int
  140. }
  141. tests := []struct {
  142. name string
  143. s *Service
  144. args args
  145. wantRes *space.ClipList
  146. }{
  147. // TODO: Add test cases.
  148. }
  149. for _, tt := range tests {
  150. t.Run(tt.name, func(t *testing.T) {
  151. if gotRes := tt.s.Clip(tt.args.c, tt.args.vmid, tt.args.pos, tt.args.size); !reflect.DeepEqual(gotRes, tt.wantRes) {
  152. t.Errorf("Service.Clip() = %v, want %v", gotRes, tt.wantRes)
  153. }
  154. })
  155. }
  156. }
  157. func TestService_Album(t *testing.T) {
  158. type args struct {
  159. c context.Context
  160. vmid int64
  161. pos int
  162. size int
  163. }
  164. tests := []struct {
  165. name string
  166. s *Service
  167. args args
  168. wantRes *space.AlbumList
  169. }{
  170. // TODO: Add test cases.
  171. }
  172. for _, tt := range tests {
  173. t.Run(tt.name, func(t *testing.T) {
  174. if gotRes := tt.s.Album(tt.args.c, tt.args.vmid, tt.args.pos, tt.args.size); !reflect.DeepEqual(gotRes, tt.wantRes) {
  175. t.Errorf("Service.Album() = %v, want %v", gotRes, tt.wantRes)
  176. }
  177. })
  178. }
  179. }
  180. func TestService_AddContribute(t *testing.T) {
  181. type args struct {
  182. c context.Context
  183. vmid int64
  184. attrs *space.Attrs
  185. items []*space.Item
  186. }
  187. tests := []struct {
  188. name string
  189. s *Service
  190. args args
  191. wantErr bool
  192. }{
  193. // TODO: Add test cases.
  194. }
  195. for _, tt := range tests {
  196. t.Run(tt.name, func(t *testing.T) {
  197. if err := tt.s.AddContribute(tt.args.c, tt.args.vmid, tt.args.attrs, tt.args.items); (err != nil) != tt.wantErr {
  198. t.Errorf("Service.AddContribute() error = %v, wantErr %v", err, tt.wantErr)
  199. }
  200. })
  201. }
  202. }