@Test public void testSome() { builder.add(1, 3.5); builder.add(3, 5.2); builder.add(-1, 0.2); MutableSparseVector vec = Vectors.fromScoredIds(builder.finish()); assertThat(vec.size(), equalTo(3)); assertThat(vec.get(1), equalTo(3.5)); assertThat(vec.get(3), equalTo(5.2)); assertThat(vec.get(-1), equalTo(0.2)); }
@Test public void testSingleton() { builder.add(1, 3.5); MutableSparseVector vec = Vectors.fromScoredIds(builder.finish()); assertThat(vec.size(), equalTo(1)); assertThat(vec.get(1), equalTo(3.5)); }