(t *testing.T)
| 160 | } |
| 161 | |
| 162 | func TestLinearSeek(t *testing.T) { |
| 163 | N := 10001 |
| 164 | enc := Encoder{BlockSize: 10} |
| 165 | for i := 0; i < N; i += 10 { |
| 166 | enc.Add(uint64(i)) |
| 167 | } |
| 168 | pack := enc.Done() |
| 169 | defer FreePack(pack) |
| 170 | dec := Decoder{Pack: pack} |
| 171 | |
| 172 | for i := 0; i < 2*N; i += 10 { |
| 173 | uids := dec.LinearSeek(uint64(i)) |
| 174 | |
| 175 | if i < N { |
| 176 | require.Contains(t, uids, uint64(i)) |
| 177 | } else { |
| 178 | require.NotContains(t, uids, uint64(i)) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | // blockIdx points to last block. |
| 183 | for i := 0; i < 9990; i += 10 { |
| 184 | uids := dec.LinearSeek(uint64(i)) |
| 185 | |
| 186 | require.NotContains(t, uids, uint64(i)) |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | func TestDecoder(t *testing.T) { |
| 191 | N := 10001 |
nothing calls this directly
no test coverage detected