20 #include <gtest/gtest.h>
49 vector<bool> nullable_tuples(1,
false);
50 vector<TTupleId> tuple_id(1, (TTupleId) 0);
55 int num_rows = end - start + 1;
57 int32_t* tuple_mem =
reinterpret_cast<int32_t*
>(
60 for (
int i = start; i <= end; ++i) {
64 row->
SetTuple(0, reinterpret_cast<Tuple*>(tuple_mem));
74 EXPECT_EQ(expected, *reinterpret_cast<int32_t*>(row->
GetTuple(0)));
78 EXPECT_LT(start, end);
82 EXPECT_TRUE(it.
GetRow() != NULL);
87 EXPECT_EQ(end, i - 1);
94 RowBatch* batch = CreateRowBatch(0, 5);
99 FullScan(&row_list, 0, 5);
109 EXPECT_TRUE(it.AtEnd());
118 for (
int batch_idx = 0; batch_idx < 100; ++batch_idx) {
120 int batch_end = batch_start + BATCH_SIZE - 1;
121 RowBatch* batch = CreateRowBatch(batch_start, batch_end);
124 FullScan(&row_list, 0, batch_end);
130 int main(
int argc,
char** argv) {
131 ::testing::InitGoogleTest(&argc, argv);
133 return RUN_ALL_TESTS();
TupleRowIterator Iterator()
Returns a new iterator over all the tuple rows.
TEST_F(InstructionCounterTest, Count)
Tuple * GetTuple(int tuple_idx)
A simple iterator used to scan over all the rows stored in the list.
void AddRowBatch(RowBatch *row_batch)
TupleRow * GetRow(int row_idx)
bool AtEnd()
Returns true if this iterator is at the end, i.e. GetRow() cannot be called.
void FullScan(RowBatchList *list, int start, int end)
void ValidateMatch(TupleRow *row, int32_t expected)
This class is thread-safe.
MemPool * tuple_data_pool()
uint64_t Test(T *ht, const ProbeTuple *input, uint64_t num_tuples)
void SetTuple(int tuple_idx, Tuple *tuple)
TupleDescBuilder & DeclareTuple()
int main(int argc, char **argv)
static void Init()
Initialize CpuInfo.
void Next()
Increments the iterator. No-op if the iterator is at the end.
RowBatch * CreateRowBatch(int start, int end)
uint8_t * Allocate(int size)
int64_t total_num_rows()
Returns the total number of rows in all row batches.