本文整理汇总了C++中Dynamic::InsertRow方法的典型用法代码示例。如果您正苦于以下问题:C++ Dynamic::InsertRow方法的具体用法?C++ Dynamic::InsertRow怎么用?C++ Dynamic::InsertRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamic
的用法示例。
在下文中一共展示了Dynamic::InsertRow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteCases
void DeleteCases()
{
std::string error;
Dynamic table = TABLE;
nkit::TableIndex::Ptr index;
nkit::TableIndex::ConstIterator it;
COMMON_TABLE_INIT(table);
index = table.CreateIndex("name,name1,name3", &error);
// Fail cases tests
NKIT_TEST_ASSERT(index);
NKIT_TEST_ASSERT(index->GetEqual(Dynamic(3), Dynamic(1)) == index->end());
NKIT_TEST_ASSERT(index->GetEqual(Dynamic("A3"), Dynamic(3)) == index->end());
// Good cases tests
for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
{
DynamicVector vargs;
vargs.push_back(Dynamic("A3"));
vargs.push_back(Dynamic(3));
vargs.push_back(Dynamic(false));
vargs.push_back(Dynamic(1));
vargs.push_back(Dynamic(double(2.0 + ops)));
NKIT_TEST_ASSERT(table.InsertRow(0, vargs));
}
for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
NKIT_TEST_ASSERT(table.DeleteRow(0));
it = index->GetEqual(Dynamic("A3"), Dynamic(3), Dynamic(1));
NKIT_TEST_ASSERT(it != index->end());
for (; it != index->end(); ++it)
{
#if defined(MY_TRACE_)
print(it[4]);
#endif // MY_TRACE_
}
NKIT_TEST_ASSERT(table == e);
}
示例2: InsertCases
void InsertCases()
{
std::string error;
Dynamic table = TABLE;
nkit::TableIndex::Ptr index;
nkit::TableIndex::ConstIterator it;
COMMON_TABLE_INIT(table);
// Fail cases tests
for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops) // wrong type
{
DynamicVector vargs;
vargs.push_back(Dynamic(1));
vargs.push_back(Dynamic(3));
vargs.push_back(Dynamic(false));
vargs.push_back(Dynamic(1));
vargs.push_back(Dynamic("name"));
NKIT_TEST_ASSERT(table.InsertRow(0, vargs) == false);
}
NKIT_TEST_ASSERT(table == e);
index = table.CreateIndex("name,name1,name3", &error);
NKIT_TEST_ASSERT(index);
NKIT_TEST_ASSERT(index->GetEqual(Dynamic(3), Dynamic(1)) == index->end());
NKIT_TEST_ASSERT(index->GetEqual(Dynamic("A3"), Dynamic(3)) == index->end());
// Good cases tests
for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
{
DynamicVector vargs;
vargs.push_back(Dynamic("A3"));
vargs.push_back(Dynamic(3));
vargs.push_back(Dynamic(false));
vargs.push_back(Dynamic(1));
vargs.push_back(Dynamic(double(2.0 + ops)));
NKIT_TEST_ASSERT(table.InsertRow(0, vargs));
}
it = index->GetEqual(Dynamic("A3"), Dynamic(3), Dynamic(1));
NKIT_TEST_ASSERT(it != index->end());
for (; it != index->end(); ++it)
{
#if defined(MY_TRACE_)
print(it[4]);
#endif // MY_TRACE_
}
for (size_t ops = 0; ops < TABLE_GROW_SIZE; ++ops)
{
DynamicVector vargs;
vargs.push_back(Dynamic("A10"));
vargs.push_back(Dynamic(3));
vargs.push_back(Dynamic(false));
vargs.push_back(Dynamic(1));
vargs.push_back(Dynamic(double(1.0 + ops)));
NKIT_TEST_ASSERT(table.InsertRow(table.height() / 2, vargs));
}
it = index->GetEqual(Dynamic("A10"), Dynamic(3), Dynamic(1));
NKIT_TEST_ASSERT(it != index->end());
for (; it != index->end(); ++it)
{
#if defined(MY_TRACE_)
print(it[4]);
#endif // MY_TRACE_
}
it = index->GetEqual(Dynamic("A"), Dynamic(1), Dynamic(1));
NKIT_TEST_ASSERT(it != index->end());
NKIT_TEST_ASSERT(it[4] == Dynamic(99.0));
it = index->GetEqual(Dynamic("A2"), Dynamic(2), Dynamic::GetDefault(detail::INTEGER));
NKIT_TEST_ASSERT(it != index->end());
it = index->GetEqual(Dynamic("A1"), Dynamic(1), Dynamic::GetDefault(detail::INTEGER));
NKIT_TEST_ASSERT(it != index->end());
}