-
Notifications
You must be signed in to change notification settings - Fork 3
/
slimarray_bug_test.go
220 lines (210 loc) · 15 KB
/
slimarray_bug_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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
package slimarray
import (
"fmt"
"testing"
"github.com/stretchr/testify/require"
)
var bug70KNums []uint32 = []uint32{0, 16, 32, 48, 64, 80, 96, 112, 128, 144,
160, 176, 192, 208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400,
416, 432, 448, 464, 480, 496, 512, 528, 544, 560, 576, 592, 608, 624, 640, 656,
672, 688, 704, 720, 736, 752, 768, 784, 800, 816, 832, 848, 864, 880, 896, 912,
928, 944, 960, 976, 992, 1008, 1024, 1040, 1056, 1072, 1088, 1104, 1120, 1136,
1152, 1168, 1184, 1200, 1216, 1232, 1248, 1264, 1280, 1296, 1312, 1328, 1344,
1360, 1376, 1392, 1408, 1424, 1440, 1456, 1472, 1488, 1504, 1520, 1536, 1552,
1568, 1584, 1600, 1616, 1632, 1648, 1664, 1680, 1696, 1712, 1728, 1744, 1760,
1776, 1792, 1808, 1824, 1840, 1856, 1872, 1888, 1904, 1920, 1936, 1952, 1968,
1984, 2000, 2016, 2032, 2048, 2064, 2080, 2096, 2112, 2128, 2144, 2160, 2176,
2192, 2208, 2224, 2240, 2256, 2272, 2288, 2304, 2320, 2336, 2352, 2368, 2384,
2400, 2416, 2432, 2448, 2464, 2480, 2496, 2512, 2528, 2544, 2560, 2576, 2592,
2608, 2624, 2640, 2656, 2672, 2688, 2704, 2720, 2736, 2752, 2768, 2784, 2800,
2816, 2832, 2848, 2864, 2880, 2896, 2912, 2928, 2944, 2960, 2976, 2992, 3008,
3024, 3040, 3056, 3072, 3088, 3104, 3120, 3136, 3152, 3168, 3184, 3200, 3216,
3232, 3248, 3264, 3280, 3296, 3312, 3328, 3344, 3360, 3376, 3392, 3408, 3424,
3440, 3456, 3472, 3488, 3504, 3520, 3536, 3552, 3568, 3584, 3600, 3616, 3632,
3648, 3664, 3680, 3696, 3712, 3728, 3744, 3760, 3776, 3792, 3808, 3824, 3840,
3856, 3872, 3888, 3904, 3920, 3936, 3952, 3968, 3984, 4000, 4016, 4032, 4048,
4064, 4080, 4096, 4112, 4128, 4144, 4160, 4176, 4192, 4208, 4224, 4240, 4256,
4272, 4288, 4304, 4320, 4336, 4352, 4368, 4384, 4400, 4416, 4432, 4448, 4464,
4480, 4496, 4512, 4528, 4544, 4560, 4576, 4592, 4608, 4624, 4640, 4656, 4672,
4688, 4704, 4720, 4736, 4752, 4768, 4784, 4800, 4816, 4832, 4848, 4864, 4880,
4896, 4912, 4928, 4944, 4960, 4976, 4992, 5008, 5024, 5040, 5056, 5072, 5088,
5104, 5120, 5136, 5152, 5168, 5184, 5200, 5216, 5232, 5248, 5264, 5280, 5296,
5312, 5328, 5344, 5360, 5376, 5392, 5408, 5424, 5440, 5456, 5472, 5488, 5504,
5520, 5536, 5552, 5568, 5584, 5600, 5616, 5632, 5648, 5664, 5680, 5696, 5712,
5728, 5744, 5760, 5776, 5792, 5808, 5824, 5840, 5856, 5872, 5888, 5904, 5920,
5936, 5952, 5968, 5984, 6000, 6016, 6032, 6048, 6064, 6080, 6096, 6112, 6128,
6144, 6160, 6176, 6192, 6208, 6224, 6240, 6256, 6272, 6288, 6304, 6320, 6336,
6352, 6368, 6384, 6400, 6416, 6432, 6448, 6464, 6480, 6496, 6512, 6528, 6544,
6560, 6576, 6592, 6608, 6624, 6640, 6656, 6672, 6688, 6704, 6720, 6736, 6752,
6768, 6784, 6800, 6816, 6832, 6848, 6864, 6880, 6896, 6912, 6928, 6944, 6960,
6976, 6992, 7008, 7024, 7040, 7056, 7072, 7088, 7104, 7120, 7136, 7152, 7168,
7184, 7200, 7216, 7232, 7248, 7264, 7280, 7296, 7312, 7328, 7344, 7360, 7376,
7392, 7408, 7424, 7440, 7456, 7472, 7488, 7504, 7520, 7536, 7552, 7568, 7584,
7600, 7616, 7632, 7648, 7664, 7680, 7696, 7712, 7728, 7744, 7760, 7776, 7792,
7808, 7824, 7840, 7856, 7872, 7888, 7904, 7920, 7936, 7952, 7968, 7984, 8000,
8016, 8032, 8048, 8064, 8080, 8096, 8112, 8128, 8144, 8160, 8176, 8192, 8208,
8224, 8240, 8256, 8272, 8288, 8304, 8320, 8336, 8352, 8368, 8384, 8400, 8416,
8432, 8448, 8464, 8480, 8496, 8512, 8528, 8544, 8560, 8576, 8592, 8608, 8624,
8640, 8656, 8672, 8688, 8704, 8720, 8736, 8752, 8768, 8784, 8800, 8816, 8832,
8848, 8864, 8880, 8896, 8912, 8928, 8944, 8960, 8976, 8992, 9008, 9024, 9040,
9056, 9072, 9088, 9104, 9120, 9136, 9152, 9168, 9184, 9200, 9216, 9232, 9248,
9264, 9280, 9296, 9312, 9328, 9344, 9360, 9376, 9392, 9408, 9424, 9440, 9456,
9472, 9488, 9504, 9520, 9536, 9552, 9568, 9584, 9600, 9616, 9632, 9648, 9664,
9680, 9696, 9712, 9728, 9744, 9760, 9776, 9792, 9808, 9824, 9840, 9856, 9872,
9888, 9904, 9920, 9936, 9952, 9968, 9984, 10000, 10016, 10032, 10048, 10064,
10080, 10096, 10112, 10128, 10144, 10160, 10176, 10192, 10208, 10224, 10240,
10256, 10272, 10288, 10304, 10320, 10336, 10352, 10368, 10384, 10400, 10416,
10432, 10448, 10464, 10480, 10496, 10512, 10528, 10544, 10560, 10576, 10592,
10608, 10624, 10640, 10656, 10672, 10688, 10704, 10720, 10736, 10752, 10768,
10784, 10800, 10816, 10832, 10848, 10864, 10880, 10896, 10912, 10928, 10944,
10960, 10976, 10992, 11008, 11024, 11040, 11056, 11072, 11088, 11104, 11120,
11136, 11152, 11168, 11184, 11200, 11216, 11232, 11248, 11264, 11280, 11296,
11312, 11328, 11344, 11360, 11376, 11392, 11408, 11424, 11440, 11456, 11472,
11488, 11504, 11520, 11536, 11552, 11568, 11584, 11600, 11616, 11632, 11648,
11664, 11680, 11696, 11712, 11728, 11744, 11760, 11776, 11792, 11808, 11824,
11840, 11856, 11872, 11888, 11904, 11920, 11936, 11952, 11968, 11984, 12000,
12016, 12032, 12048, 12064, 12080, 12096, 12112, 12128, 12144, 12160, 12176,
12192, 12208, 12224, 12240, 12256, 12272, 12288, 12304, 12320, 12336, 12352,
12368, 12384, 12400, 12416, 12432, 12448, 12464, 12480, 12496, 12512, 12528,
12544, 12560, 12576, 12592, 12608, 12624, 12640, 12656, 12672, 12688, 12704,
12720, 12736, 12752, 12768, 12784, 12800, 12816, 12832, 12848, 12864, 12880,
12896, 12912, 12928, 12944, 12960, 12976, 12992, 13008, 13024, 13040, 13056,
13072, 13088, 13104, 13120, 13136, 13152, 13168, 13184, 13200, 13216, 13232,
13248, 13264, 13280, 13296, 13312, 13328, 13344, 13360, 13376, 13392, 13408,
13424, 13440, 13456, 13472, 13488, 13504, 13520, 13536, 13552, 13568, 13584,
13600, 13616, 13632, 13648, 13664, 13680, 13696, 13712, 13728, 13744, 13760,
13776, 13792, 13808, 13824, 13840, 13856, 13872, 13888, 13904, 13920, 13936,
13952, 13968, 13984, 14000, 14016, 14032, 14048, 14064, 14080, 14096, 14112,
14128, 14144, 14160, 14176, 14192, 14208, 14224, 14240, 14256, 14272, 14288,
14304, 14320, 14336, 14352, 14368, 14384, 14400, 14416, 14432, 14448, 14464,
14480, 14496, 14512, 14528, 14544, 14560, 14576, 14592, 14608, 14624, 14640,
14656, 14672, 14688, 14704, 14720, 14736, 14752, 14768, 14784, 14800, 14816,
14832, 14848, 14864, 14880, 14896, 14912, 14928, 14944, 14960, 14976, 14992,
15008, 15024, 15040, 15056, 15072, 15088, 15104, 15120, 15136, 15152, 15168,
15184, 15200, 15216, 15232, 15248, 15264, 15280, 15296, 15312, 15328, 15344,
15360, 15376, 15392, 15408, 15424, 15440, 15456, 15472, 15488, 15504, 15520,
15536, 15552, 15568, 15584, 15600, 15616, 15632, 15648, 15664, 15680, 15696,
15712, 15728, 15744, 15760, 15776, 15792, 15808, 15824, 15840, 15856, 15872,
15888, 15904, 15920, 15936, 15952, 15968, 15984, 16000, 16016, 16032, 16048,
16064, 16080, 16096, 16112, 16128, 16144, 16160, 16176, 16192, 16208, 16224,
16240, 16256, 16272, 16288, 16304, 16320, 16336, 16352, 16368, 16384, 16400,
16416, 16432, 16448, 16464, 16480, 16496, 16512, 16528, 16544, 16560, 16576,
16592, 16608, 16624, 16640, 16656, 16672, 16688, 16704, 16720, 16736, 16752,
16768, 16784, 16800, 16816, 16832, 16848, 16864, 16880, 16896, 16912, 16928,
16944, 16960, 16976, 16992, 17008, 17024, 17040, 17056, 17072, 17088, 17104,
17120, 17136, 17152, 17168, 17184, 17200, 17216, 17232, 17248, 17264, 17280,
17296, 17312, 17328, 17344, 17360, 17376, 17392, 17408, 17424, 17440, 17456,
17472, 17488, 17504, 17520, 17536, 17552, 17568, 17584, 17600, 17616, 17632,
17648, 17664, 17680, 17696, 17712, 17728, 17744, 17760, 17776, 17792, 17808,
17824, 17840, 17856, 17872, 17888, 17904, 17920, 17936, 17952, 17968, 17984,
18000, 18016, 18032, 18048, 18064, 18080, 18096, 18112, 18128, 18144, 18160,
18176, 18192, 18208, 18224, 18240, 18256, 18272, 18288, 18304, 18320, 18336,
18352, 18368, 18384, 18400, 18416, 18432, 18448, 18464, 18480, 18496, 18512,
18528, 18544, 18560, 18576, 18592, 18608, 18624, 18640, 18656, 18672, 18688,
18704, 18720, 18736, 18752, 18768, 18784, 18800, 18816, 18832, 18848, 18864,
18880, 18896, 18912, 18928, 18944, 18960, 18976, 18992, 19008, 19024, 19040,
19056, 19072, 19088, 19104, 19120, 19136, 19152, 19168, 19184, 19200, 19216,
19232, 19248, 19264, 19280, 19296, 19312, 19328, 19344, 19360, 19376, 19392,
19408, 19424, 19440, 19456, 19472, 19488, 19504, 19520, 19536, 19552, 19568,
19584, 19600, 19616, 19632, 19648, 19664, 19680, 19696, 19712, 19728, 19744,
19760, 19776, 19792, 19808, 19824, 19840, 19856, 19872, 19888, 19904, 19920,
19936, 19952, 19968, 19984, 20000, 20016, 20032, 20048, 20064, 20080, 20096,
20112, 20128, 20144, 20160, 20176, 20192, 20208, 20224, 20240, 20256, 20272,
20288, 20304, 20320, 20336, 20352, 20368, 20384, 20400, 20416, 20432, 20448,
20464, 20480, 20496, 20512, 20528, 20544, 20560, 20576, 20592, 20608, 20624,
20640, 20656, 20672, 20688, 20704, 20720, 20736, 20752, 20768, 20784, 20800,
20816, 20832, 20848, 20864, 20880, 20896, 20912, 20928, 20944, 20960, 20976,
20992, 21008, 21024, 21040, 21056, 21072, 21088, 21104, 21120, 21136, 21152,
21168, 21184, 21200, 21216, 21232, 21248, 21264, 21280, 21296, 21312, 21328,
21344, 21360, 21376, 21392, 21408, 21424, 21440, 21456, 21472, 21488, 21504,
21520, 21536, 21552, 21568, 21584, 21600, 21616, 21632, 21648, 21664, 21680,
21696, 21712, 21728, 21744, 21760, 21776, 21792, 21808, 21824, 21840, 21856,
21872, 21888, 21904, 21920, 21936, 21952, 21968, 21984, 22000, 22016, 22032,
22048, 22064, 22080, 22096, 22112, 22128, 22144, 22160, 22176, 22192, 22208,
22224, 22240, 22256, 22272, 22288, 22304, 22320, 22336, 22352, 22368, 22384,
22400, 22416, 22432, 22448, 22464, 22480, 22496, 22512, 22528, 22544, 22560,
22576, 22592, 22608, 22624, 22640, 22656, 22672, 22688, 22704, 22720, 22736,
22752, 22768, 22784, 22800, 22816, 22832, 22848, 22864, 22880, 22896, 22912,
22928, 22944, 22960, 22976, 22992, 23008, 23024, 23040, 23056, 23072, 23088,
23104, 23120, 23136, 23152, 23168, 23184, 23200, 23216, 23232, 23248, 23264,
23280, 23296, 23312, 23328, 23344, 23360, 23376, 23392, 23408, 23424, 23440,
23456, 23472, 23488, 23504, 23520, 23536, 23552, 23568, 23584, 23600, 23616,
23632, 23648, 23664, 23680, 23696, 23712, 23728, 23744, 23760, 23776, 23792,
23808, 23824, 23840, 23856, 23872, 23888, 23904, 23920, 23936, 23952, 23968,
23984, 24000, 24016, 24032, 24048, 24064, 24080, 24096, 24112, 24128, 24144,
24160, 24176, 24192, 24208, 24224, 24240, 24256, 24272, 24288, 24304, 24320,
24336, 24352, 24368, 24384, 24400, 24416, 24432, 24448, 24464, 24480, 24496,
24512, 24528, 24544, 24560, 24576, 24592, 24608, 24624, 24640, 24656, 24672,
24688, 24704, 24720, 24736, 24752, 24768, 24784, 24800, 24816, 24832, 24848,
24864, 24880, 24896, 24912, 24928, 24944, 24960, 24976, 24992, 25008, 25024,
25040, 25056, 25072, 25088, 25104, 25120, 25136, 25152, 25168, 25184, 25200,
25216, 25232, 25248, 25264, 25280, 25296, 25312, 25328, 25344, 25360, 25376,
25392, 25408, 25424, 25440, 25456, 25472, 25488, 25504, 25520, 25536, 25552,
25568, 25584, 25600, 25616, 25632, 25648, 25664, 25680, 25696, 25712, 25728,
25744, 25760, 25776, 25792, 25808, 25824, 25840, 25856, 25872, 25888, 25904,
25920, 25936, 25952, 25968, 25984, 26000, 26016, 26032, 26048, 26064, 26080,
26096, 26112, 26128, 26144, 26160, 26176, 26192, 26208, 26224, 26240, 26256,
26272, 26288, 26304, 26320, 26336, 26352, 26368, 26384, 26400, 26416, 26432,
26448, 26464, 26480, 26496, 26512, 26528, 26544, 26560, 26576, 26592, 26608,
26624, 26640, 26656, 26672, 26688, 26704, 26720, 26736, 26752, 26768, 26784,
26800, 26816, 26832, 26848, 26864, 26880, 26896, 26912, 26928, 26944, 26960,
26976, 26992, 27008, 27024, 27040, 27056, 27072, 27088, 27104, 27120, 27136,
27152, 27168, 27184, 27200, 27216, 27232, 27248, 27264, 27280, 27296, 27312,
27328, 27344, 27360, 27376, 27392, 27408, 27424, 27440, 27456, 27472, 27488,
27504, 27520, 27536, 27552, 27568, 27584, 27600, 27616, 27632, 27648, 27664,
27680, 27696, 27712, 27728, 27744, 27760, 27776, 27792, 27808, 27824, 27840,
27856, 27872, 27888, 27904, 27920, 27936, 27952, 27968, 27984, 28000, 28016,
28032, 28048, 28064, 28080, 28096, 28112, 28128, 28144, 28160, 28176, 28192,
28208, 28224, 28240, 28256, 28272, 28288, 28304, 28320, 28336, 28352, 28368,
28384, 28400, 28416, 28432, 28448, 28464, 28480, 28496, 28512, 28528, 28544,
28560, 28576, 28592, 28608, 28624, 28640, 28656, 28672, 28688, 28704, 28720,
28736, 28752, 28768, 28784, 28800, 28816, 28832, 28848, 28864, 28880, 28896,
28912, 28928, 28944, 28960, 28976, 28992, 29008, 29024, 29040, 29056, 29072,
29088, 29104, 29120, 29136, 29152, 29168, 29184, 29200, 29216, 29232, 29248,
29264, 29280, 29296, 29312, 29328, 29344, 29360, 29376, 29392, 29408, 29424,
29440, 29456, 29472, 29488, 29504, 29520, 29536, 29552, 29568, 29584, 29600,
29616, 29632, 29648, 29664, 29680, 29696, 29712, 29728, 29744, 29760, 29776,
29792, 29808, 29824, 29840, 29856, 29872, 29888, 29904, 29920, 29936, 29952,
29968, 29984, 30000, 30016, 30032, 30048, 30064, 30080, 30096, 30112, 30128,
30144, 30160, 30176, 30192, 30208, 30224, 30240, 30256, 30272, 30288, 30304,
30320, 30336, 30352, 30368, 30384, 30400, 30416, 30432, 30448, 30464, 30480,
30496, 30512, 30528, 30544, 30560, 30576, 30592, 30608, 30624, 30640, 30656,
30672, 30688, 30704, 30720, 30736, 30752, 30768, 30784, 30800, 30816, 30832,
30848, 30864, 30880, 30896, 30912, 30928, 30944, 30960, 30976, 30992, 31008,
31024, 31040, 31056, 31072, 31088, 31104, 31120, 31136, 31152, 31168, 31184,
31200, 31216, 31232, 31248, 31264, 31280, 31296, 31312, 31328, 31344, 31360,
31376, 31392, 31408, 31424, 31440, 31456, 31472, 31488, 31504, 31520, 31536,
31552, 31568, 31584, 31600, 31616, 31632, 31648, 31664, 31680, 31696, 31712,
31728, 31744, 31760, 31776, 31792, 31808, 31824, 31840, 31856, 31872, 31888,
31904, 31920, 31936, 31952, 31968, 31984, 32000, 32016, 32032, 32048, 32064,
32080, 32096, 32112, 32128, 32144, 32160, 32176, 32192, 32208, 32224, 32240,
32256, 32272, 32288, 32304, 32320, 32336, 32352, 32368, 32384, 32400, 32416,
32432, 32448, 32464, 32480, 32496, 32512, 32528, 32544, 32560, 32576, 32592,
32608, 32624, 32640, 32656, 32672, 32688, 32704, 32720, 32736, 32752, 32768,
32784, 32800, 32816, 32832, 32848, 32864, 32880, 32896, 32912, 32928, 32944,
32960, 32976, 32992, 33008, 33024, 33040, 33056, 33072, 33088, 33104, 33120,
33136, 33152, 33168, 33184, 33200, 33216, 33232, 33248, 33264, 33280, 33296,
33312, 33328, 33344, 33360, 33376, 33392, 33408, 33424, 33440, 33456, 33472,
33488, 33504, 33520, 33536, 33552, 33568, 33584, 33600, 33616, 33632, 33648,
33664, 33680, 33696, 33712, 33728, 33744, 33760, 33776, 33792, 33808, 33824,
33840, 33856, 33872, 33888, 33904, 33920, 33936, 33952, 33968, 33984, 34000,
34016, 34032, 34048, 34064, 34080, 34096, 34112, 34128, 34144, 34160, 34176,
34192, 34208, 34224, 34240, 34256, 34272, 34288, 34304, 34320, 34336, 34352,
34368, 34384, 34400, 34416, 34432, 34448, 34464, 34480, 34496, 34512, 34528,
34544, 34560, 34576, 34592, 34608, 34624, 34640, 34656, 34672, 34688, 34704,
34720, 34736, 34752, 34768, 34784, 34800, 34816, 34832, 34848, 34864, 34880,
34896, 34912, 34928, 34944, 34960, 34976, 34992, 35008, 35024, 35040, 35056,
35072, 35088, 35104, 35120, 35136, 35152, 35168, 35184, 35200, 35216, 35232,
}
func TestSlimArray_bug_start_overflow_2019_06_08(t *testing.T) {
// typo of segment with. should be segment size.
ta := require.New(t)
nums := bug70KNums
a := NewU32(nums)
for i, n := range nums {
r := a.Get(int32(i))
ta.Equal(n, r, "i=%d", i)
}
ta.Equal(len(nums), a.Len())
fmt.Println(a.Stat())
}