souffle
2.0.2-371-g6315b36
|
Go to the documentation of this file.
29 TEST(SymbolTable, Basics) {
32 table.insert(
"Hello");
34 EXPECT_STREQ(
"Hello", table.resolve(table.lookup(table.resolve(table.lookup(
"Hello")))));
36 EXPECT_EQ(table.lookup(
"Hello"), table.lookup(table.resolve(table.lookup(
"Hello"))));
38 EXPECT_STREQ(
"Hello", table.resolve(table.lookup(table.resolve(table.lookup(
"Hello")))));
41 table.lookup(table.resolve(table.lookup(table.resolve(table.lookup(
"Hello"))))));
50 size_t a_idx = a->lookup(
"Hello");
51 size_t b_idx =
b->lookup(
"Hello");
78 size_t a_idx = a->
lookup(
"Hello");
79 size_t b_idx =
b.lookup(
"Hello");
80 size_t c_idx = c.
lookup(
"Hello");
99 const bool ECHO_TIME =
false;
102 using T =
unsigned long long;
114 std::vector<std::string> A;
117 for (T
i = 0;
i < N; ++
i) {
118 x = std::to_string(
i) +
"string";
122 for (T
i = 0;
i < N; ++
i) {
129 std::cout <<
"Time to insert " << N <<
" new elements: " <<
n <<
" ns" << std::endl;
139 std::cout <<
"Time to insert " << N <<
" existing elements: " <<
n <<
" ns" << std::endl;
void insert(const std::vector< std::string > &symbols)
Bulk insert symbols into the table, note that this operation is more efficient than repeated inserts ...
const std::string & resolve(const RamDomain index) const
Find a symbol in the table by its index, note that this gives an error if the index is out of bounds.
std::chrono::high_resolution_clock::time_point time_point
RamDomain lookup(const std::string &symbol)
Find the index of a symbol in the table, inserting a new symbol if it does not exist there already.
long duration_in_ns(const time_point &start, const time_point &end)
l j a showGridBackground &&c b raw series this eventEmitter b
#define EXPECT_STREQ(a, b)