本文整理汇总了C++中SparseArray::getNumRows方法的典型用法代码示例。如果您正苦于以下问题:C++ SparseArray::getNumRows方法的具体用法?C++ SparseArray::getNumRows怎么用?C++ SparseArray::getNumRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SparseArray
的用法示例。
在下文中一共展示了SparseArray::getNumRows方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(SparseArrayRow, NumRow) {
SparseArray<int>* tDInt = new SparseArray<int>(10, 10, 0);
SparseArray<double>* tDDouble = new SparseArray<double>(11, 11, 0.0);
SparseArray<string>* tDString = new SparseArray<string>(12, 12, "0");
EXPECT_EQ(10, tDInt->getNumRows());
delete tDInt;
EXPECT_EQ(11, tDDouble->getNumRows());
delete tDDouble;
EXPECT_EQ(12, tDString->getNumRows());
delete tDString;
}
示例2:
TEST(sparseTest, getNumRows) {
SparseArray<int>* i = new SparseArray<int>(5, 5, 0);
SparseArray<double>* d = new SparseArray<int>(6, 5, 0);
SparseArray<std::string>* s = new SparseArray<std::string>(10, 5, "o");
i->insert(2, 2, 7);
d->insert(4, 4, 3.145);
s->insert(0, 0, "Hello");
EXPECT_EQ(5, i->getNumRows());
EXPECT_EQ(6, d->getNumRows());
EXPECT_EQ(10, s->getNumRows());
delete i;
delete d;
delete s;
}
示例3:
TEST(Sparse, GetNumRows) {
SparseArray<int>* newSparse = new SparseArray<int>(7,8,0);
EXPECT_EQ(8, newSparse->getNumRows());
delete newSparse;
}