@@ -14,23 +14,23 @@ import (
14
14
"testing"
15
15
16
16
"github.com/dgraph-io/dgraph/bp128"
17
- "github.com/dgraph-io/dgraph/protos/intern "
17
+ "github.com/dgraph-io/dgraph/protos/pb "
18
18
"github.com/stretchr/testify/require"
19
19
)
20
20
21
- func newList (data []uint64 ) * intern .List {
22
- return & intern .List {data }
21
+ func newList (data []uint64 ) * pb .List {
22
+ return & pb .List {data }
23
23
}
24
24
25
25
func TestMergeSorted1 (t * testing.T ) {
26
- input := []* intern .List {
26
+ input := []* pb .List {
27
27
newList ([]uint64 {55 }),
28
28
}
29
29
require .Equal (t , MergeSorted (input ).Uids , []uint64 {55 })
30
30
}
31
31
32
32
func TestMergeSorted2 (t * testing.T ) {
33
- input := []* intern .List {
33
+ input := []* pb .List {
34
34
newList ([]uint64 {1 , 3 , 6 , 8 , 10 }),
35
35
newList ([]uint64 {2 , 4 , 5 , 7 , 15 }),
36
36
}
@@ -39,31 +39,31 @@ func TestMergeSorted2(t *testing.T) {
39
39
}
40
40
41
41
func TestMergeSorted3 (t * testing.T ) {
42
- input := []* intern .List {
42
+ input := []* pb .List {
43
43
newList ([]uint64 {1 , 3 , 6 , 8 , 10 }),
44
44
newList ([]uint64 {}),
45
45
}
46
46
require .Equal (t , MergeSorted (input ).Uids , []uint64 {1 , 3 , 6 , 8 , 10 })
47
47
}
48
48
49
49
func TestMergeSorted4 (t * testing.T ) {
50
- input := []* intern .List {
50
+ input := []* pb .List {
51
51
newList ([]uint64 {}),
52
52
newList ([]uint64 {1 , 3 , 6 , 8 , 10 }),
53
53
}
54
54
require .Equal (t , MergeSorted (input ).Uids , []uint64 {1 , 3 , 6 , 8 , 10 })
55
55
}
56
56
57
57
func TestMergeSorted5 (t * testing.T ) {
58
- input := []* intern .List {
58
+ input := []* pb .List {
59
59
newList ([]uint64 {}),
60
60
newList ([]uint64 {}),
61
61
}
62
62
require .Empty (t , MergeSorted (input ).Uids )
63
63
}
64
64
65
65
func TestMergeSorted6 (t * testing.T ) {
66
- input := []* intern .List {
66
+ input := []* pb .List {
67
67
newList ([]uint64 {11 , 13 , 16 , 18 , 20 }),
68
68
newList ([]uint64 {12 , 14 , 15 , 15 , 16 , 16 , 17 , 25 }),
69
69
newList ([]uint64 {1 , 2 }),
@@ -73,7 +73,7 @@ func TestMergeSorted6(t *testing.T) {
73
73
}
74
74
75
75
func TestMergeSorted7 (t * testing.T ) {
76
- input := []* intern .List {
76
+ input := []* pb .List {
77
77
newList ([]uint64 {5 , 6 , 7 }),
78
78
newList ([]uint64 {3 , 4 }),
79
79
newList ([]uint64 {1 , 2 }),
@@ -83,54 +83,54 @@ func TestMergeSorted7(t *testing.T) {
83
83
}
84
84
85
85
func TestMergeSorted8 (t * testing.T ) {
86
- input := []* intern .List {}
86
+ input := []* pb .List {}
87
87
require .Empty (t , MergeSorted (input ).Uids )
88
88
}
89
89
90
90
func TestMergeSorted9 (t * testing.T ) {
91
- input := []* intern .List {
91
+ input := []* pb .List {
92
92
newList ([]uint64 {1 , 1 , 1 }),
93
93
}
94
94
require .Equal (t , MergeSorted (input ).Uids , []uint64 {1 })
95
95
}
96
96
97
97
func TestMergeSorted10 (t * testing.T ) {
98
- input := []* intern .List {
98
+ input := []* pb .List {
99
99
newList ([]uint64 {1 , 2 , 3 , 3 , 6 }),
100
100
newList ([]uint64 {4 , 8 , 9 }),
101
101
}
102
102
require .Equal (t , MergeSorted (input ).Uids , []uint64 {1 , 2 , 3 , 4 , 6 , 8 , 9 })
103
103
}
104
104
105
105
func TestIntersectSorted1 (t * testing.T ) {
106
- input := []* intern .List {
106
+ input := []* pb .List {
107
107
newList ([]uint64 {1 , 2 , 3 }),
108
108
newList ([]uint64 {2 , 3 , 4 , 5 }),
109
109
}
110
110
require .Equal (t , []uint64 {2 , 3 }, IntersectSorted (input ).Uids )
111
111
}
112
112
113
113
func TestIntersectSorted2 (t * testing.T ) {
114
- input := []* intern .List {
114
+ input := []* pb .List {
115
115
newList ([]uint64 {1 , 2 , 3 }),
116
116
}
117
117
require .Equal (t , IntersectSorted (input ).Uids , []uint64 {1 , 2 , 3 })
118
118
}
119
119
120
120
func TestIntersectSorted3 (t * testing.T ) {
121
- input := []* intern .List {}
121
+ input := []* pb .List {}
122
122
require .Empty (t , IntersectSorted (input ).Uids )
123
123
}
124
124
125
125
func TestIntersectSorted4 (t * testing.T ) {
126
- input := []* intern .List {
126
+ input := []* pb .List {
127
127
newList ([]uint64 {100 , 101 }),
128
128
}
129
129
require .Equal (t , IntersectSorted (input ).Uids , []uint64 {100 , 101 })
130
130
}
131
131
132
132
func TestIntersectSorted5 (t * testing.T ) {
133
- input := []* intern .List {
133
+ input := []* pb .List {
134
134
newList ([]uint64 {1 , 2 , 3 }),
135
135
newList ([]uint64 {2 , 3 , 4 , 5 }),
136
136
newList ([]uint64 {4 , 5 , 6 }),
@@ -139,7 +139,7 @@ func TestIntersectSorted5(t *testing.T) {
139
139
}
140
140
141
141
func TestIntersectSorted6 (t * testing.T ) {
142
- input := []* intern .List {
142
+ input := []* pb .List {
143
143
newList ([]uint64 {10 , 12 , 13 }),
144
144
newList ([]uint64 {2 , 3 , 4 , 13 }),
145
145
newList ([]uint64 {4 , 5 , 6 }),
@@ -148,7 +148,7 @@ func TestIntersectSorted6(t *testing.T) {
148
148
}
149
149
150
150
func TestDiffSorted1 (t * testing.T ) {
151
- input := []* intern .List {
151
+ input := []* pb .List {
152
152
newList ([]uint64 {1 , 2 , 3 }),
153
153
newList ([]uint64 {1 }),
154
154
}
@@ -157,7 +157,7 @@ func TestDiffSorted1(t *testing.T) {
157
157
}
158
158
159
159
func TestDiffSorted2 (t * testing.T ) {
160
- input := []* intern .List {
160
+ input := []* pb .List {
161
161
newList ([]uint64 {1 , 2 , 3 }),
162
162
newList ([]uint64 {2 }),
163
163
}
@@ -166,7 +166,7 @@ func TestDiffSorted2(t *testing.T) {
166
166
}
167
167
168
168
func TestDiffSorted3 (t * testing.T ) {
169
- input := []* intern .List {
169
+ input := []* pb .List {
170
170
newList ([]uint64 {1 , 2 , 3 }),
171
171
newList ([]uint64 {3 }),
172
172
}
@@ -175,7 +175,7 @@ func TestDiffSorted3(t *testing.T) {
175
175
}
176
176
177
177
func TestDiffSorted4 (t * testing.T ) {
178
- input := []* intern .List {
178
+ input := []* pb .List {
179
179
newList ([]uint64 {1 , 2 , 3 }),
180
180
newList ([]uint64 {}),
181
181
}
@@ -184,7 +184,7 @@ func TestDiffSorted4(t *testing.T) {
184
184
}
185
185
186
186
func TestDiffSorted5 (t * testing.T ) {
187
- input := []* intern .List {
187
+ input := []* pb .List {
188
188
newList ([]uint64 {}),
189
189
newList ([]uint64 {1 , 2 }),
190
190
}
@@ -193,7 +193,7 @@ func TestDiffSorted5(t *testing.T) {
193
193
}
194
194
195
195
func TestSubSorted1 (t * testing.T ) {
196
- input := []* intern .List {
196
+ input := []* pb .List {
197
197
newList ([]uint64 {1 , 2 , 3 }),
198
198
newList ([]uint64 {2 , 3 , 4 , 5 }),
199
199
}
@@ -202,7 +202,7 @@ func TestSubSorted1(t *testing.T) {
202
202
}
203
203
204
204
func TestSubSorted6 (t * testing.T ) {
205
- input := []* intern .List {
205
+ input := []* pb .List {
206
206
newList ([]uint64 {10 , 12 , 13 }),
207
207
newList ([]uint64 {2 , 3 , 4 , 13 }),
208
208
}
@@ -290,8 +290,8 @@ func BenchmarkListIntersectRandom(b *testing.B) {
290
290
291
291
u := newList (u1 )
292
292
v := newList (v1 )
293
- dst1 := & intern .List {}
294
- dst2 := & intern .List {}
293
+ dst1 := & pb .List {}
294
+ dst2 := & pb .List {}
295
295
compressedUids := bp128 .DeltaPack (u1 )
296
296
297
297
b .Run (fmt .Sprintf (":size=%d:overlap=%.2f:" , arrSz , overlap ),
@@ -353,10 +353,10 @@ func BenchmarkListIntersectRatio(b *testing.B) {
353
353
sort .Slice (u1 , func (i , j int ) bool { return u1 [i ] < u1 [j ] })
354
354
sort .Slice (v1 , func (i , j int ) bool { return v1 [i ] < v1 [j ] })
355
355
356
- u := & intern .List {u1 }
357
- v := & intern .List {v1 }
358
- dst1 := & intern .List {}
359
- dst2 := & intern .List {}
356
+ u := & pb .List {u1 }
357
+ v := & pb .List {v1 }
358
+ dst1 := & pb .List {}
359
+ dst2 := & pb .List {}
360
360
compressedUids := bp128 .DeltaPack (v1 )
361
361
362
362
fmt .Printf ("len: %d, compressed: %d, bytes/int: %f\n " ,
0 commit comments