-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_buff_test.go
executable file
·82 lines (51 loc) · 1.27 KB
/
data_buff_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
package offline_alloc
import (
"fmt"
"testing"
)
func MockAdOrderItem() *AdOrderItem {
obj := NewAdOrderItem()
/*sex_arr := make([]int, 1)
sex_arr[0] = 1
obj.M_TargetAttr[Sex] = sex_arr
age_arr := make([]int, 2)
age_arr[0] = 2
age_arr[1] = 3
obj.M_TargetAttr[Age] = age_arr*/
area_arr := make([]int, 1)
area_arr[0] = 4
obj.M_TargetAttr[Area] = area_arr
return obj
}
func MockAdOrderItem2() *AdOrderItem {
obj := NewAdOrderItem()
/*sex_arr := make([]int, 1)
sex_arr[0] = 1
obj.M_TargetAttr[Sex] = sex_arr*/
age_arr := make([]int, 2)
age_arr[0] = 1
age_arr[1] = 3
obj.M_TargetAttr[Age] = age_arr
/*area_arr := make([]int, 1)
area_arr[0] = 4
obj.M_TargetAttr[Area] = area_arr*/
return obj
}
func TestMergeTargetAttr(t *testing.T) {
InitTargetInfo()
data_buff := NewDataBuff()
order := MockAdOrderItem()
order2 := MockAdOrderItem2()
data_buff.AddOrderItem(order)
data_buff.AddOrderItem(order2)
for i := 0; i < TargetNum; i++ {
data_buff.MergeTargetAttr(i)
}
data_buff.AllMergeTargetAttr()
//fmt.Println(data_buff.M_MergeAttr2TargetAttr)
//fmt.Println(data_buff.M_MergeAttr2TargetAttr)
//fmt.Println(data_buff.M_FlatMergeAttr2AllMergeAttr)
fmt.Println(data_buff.M_AllMergeAttr2FlatMergeAttr)
fmt.Println(order)
fmt.Println(order2)
}