MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / TEST_F

Function TEST_F

src/storage/mem_table_iterator_test.cc:27–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25class MemTableIteratorTest : public ::testing::Test {};
26
27TEST_F(MemTableIteratorTest, smoketest) {
28 std::map<std::string, uint32_t> mapping;
29 mapping.insert(std::make_pair("idx0", 0));
30 MemTable* table = new MemTable("tx_log", 1, 1, 8, mapping, 10,
31 ::fedb::type::TTLType::kAbsoluteTime);
32 std::string key = "test";
33 std::string value = "test";
34 uint64_t now = ::baidu::common::timer::get_micros() / 1000;
35 table->Init();
36 table->Put(key, now, value.c_str(), value.size());
37 ::hybridse::vm::WindowIterator* it = table->NewWindowIterator(0);
38 it->SeekToFirst();
39 ASSERT_TRUE(it != NULL);
40 ASSERT_TRUE(it->Valid());
41 ::hybridse::codec::Row row = it->GetKey();
42 ASSERT_EQ(row.ToString(), key);
43 std::unique_ptr<::hybridse::vm::RowIterator> wit = it->GetValue();
44 wit->SeekToFirst();
45 ASSERT_TRUE(wit->Valid());
46 ::hybridse::codec::Row value2 = wit->GetValue();
47 ASSERT_EQ(value2.ToString(), value);
48 ASSERT_EQ(now, wit->GetKey());
49 it->Next();
50 ASSERT_FALSE(it->Valid());
51}
52
53} // namespace storage
54} // namespace fedb

Callers

nothing calls this directly

Calls 11

insertMethod · 0.80
NewWindowIteratorMethod · 0.80
InitMethod · 0.45
PutMethod · 0.45
sizeMethod · 0.45
SeekToFirstMethod · 0.45
ValidMethod · 0.45
GetKeyMethod · 0.45
ToStringMethod · 0.45
GetValueMethod · 0.45
NextMethod · 0.45

Tested by

no test coverage detected