assertTrue(ratings.contains(preference(7, 10, 4)));
}
@Test
public void testUserRatingVector() {
SparseVector ratings = snap.userRatingVector(1);
assertEquals(4, ratings.size());
assertEquals(4, ratings.get(7), EPSILON);
assertEquals(5, ratings.get(8), EPSILON);
assertEquals(3, ratings.get(9), EPSILON);
assertEquals(5, ratings.get(11), EPSILON);
ratings = snap.userRatingVector(2);
assertEquals(0, ratings.size());
ratings = snap.userRatingVector(3);
assertEquals(4, ratings.size());
assertEquals(3, ratings.get(7), EPSILON);
assertEquals(3, ratings.get(8), EPSILON);
assertEquals(4, ratings.get(9), EPSILON);
assertEquals(5, ratings.get(11), EPSILON);
ratings = snap.userRatingVector(4);
assertEquals(5, ratings.size());
assertEquals(4, ratings.get(7), EPSILON);
assertEquals(2, ratings.get(8), EPSILON);
assertEquals(5, ratings.get(9), EPSILON);
assertEquals(4, ratings.get(10), EPSILON);
assertEquals(5, ratings.get(11), EPSILON);
ratings = snap.userRatingVector(5);
assertEquals(2, ratings.size());
assertEquals(3, ratings.get(7), EPSILON);
assertEquals(5, ratings.get(8), EPSILON);
ratings = snap.userRatingVector(6);
assertEquals(2, ratings.size());
assertEquals(5, ratings.get(7), EPSILON);
assertEquals(5, ratings.get(8), EPSILON);
ratings = snap.userRatingVector(7);
assertEquals(3, ratings.size());
assertEquals(2, ratings.get(8), EPSILON);
assertEquals(3, ratings.get(9), EPSILON);
assertEquals(4, ratings.get(10), EPSILON);
}