コード例 #1
0
// Checks whether a filter is empty and checks invariants.
static void expect_empty(const filter_t &c) {
  EXPECT_TRUE(c.empty());
  EXPECT_EQ(0, c.size());
  EXPECT_EQ(0, distance(c.begin(), c.end()));
  EXPECT_FLOAT_EQ(0.0f, c.load_factor());
  EXPECT_LE(c.load_factor(), c.max_load_factor());
}
コード例 #2
0
static void expect_properties(const filter_t &c, const slots_status sstatus,
                              const test_hash hash_fn, const float ml) {
  switch (sstatus.status) {
  case slots_status::exactly:
    EXPECT_EQ(sstatus.slot_count, c.slot_count());
    break;
  case slots_status::at_least:
    // Note: probably replace EXPECT_LE with EXPECT_EQ will be the same since
    // the current implementation always use the minimal space it can.
    EXPECT_LE(sstatus.slot_count, c.slot_count());
    break;
  }

  EXPECT_EQ(hash_fn, c.hash_function());
  EXPECT_EQ(ml, c.max_load_factor());
}