| 215 | } |
| 216 | |
| 217 | bool test_errors() { |
| 218 | IndexFixture f("test_errors"); |
| 219 | if (!f.init()) return false; |
| 220 | |
| 221 | f.add(1, "first"); |
| 222 | if (f.add(1, "second") == 0) return false; |
| 223 | |
| 224 | if (f.get(999).first == 0) return false; |
| 225 | |
| 226 | if (f.del(999) == 0) return false; |
| 227 | |
| 228 | f.del(1); |
| 229 | if (f.del(1) == 0) return false; |
| 230 | |
| 231 | std::vector<float> zero_emb(DIM, 0.0f); |
| 232 | if (f.add(2, "zero", zero_emb) == 0) return false; |
| 233 | |
| 234 | return true; |
| 235 | } |
| 236 | |
| 237 | bool test_unicode() { |
| 238 | IndexFixture f("test_unicode"); |