本文整理汇总了C++中Asset::getAbsolutePathToFile方法的典型用法代码示例。如果您正苦于以下问题:C++ Asset::getAbsolutePathToFile方法的具体用法?C++ Asset::getAbsolutePathToFile怎么用?C++ Asset::getAbsolutePathToFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Asset
的用法示例。
在下文中一共展示了Asset::getAbsolutePathToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testImport
/**
* @brief Tests import of ImportNewData.
*/
void TestCreateAsset::testImport() {
QDate startDate = QDate::fromString("2014-01-01", "yyyy-MM-dd");
QDate endDate = QDate::fromString("2014-02-01", "yyyy-MM-dd");
Asset b = Asset("Gogolea", "../Examples/Gogolea_test.csv", "Yahoo", startDate, endDate);
CreateAsset algo = CreateAsset();
algo.import(b, "../../Examples/table.csv");
SessionSaver::getInstance()->saveAsset(b);
QString data;
QFile importedCSV(b.getAbsolutePathToFile());
QStringList dataRows;
QStringList dataRow;
if (importedCSV.open(QFile::ReadOnly)) {
data = importedCSV.readAll();
dataRows = data.split("\n");
importedCSV.close();
}
QCOMPARE(dataRows.size(), 23);
// Checks first date:
dataRow = dataRows.at(1).split(",");
QVERIFY(endDate >= QDate::fromString(dataRow[0], "yyyy-MM-dd"));
// Checks last date:
dataRow = dataRows.at(dataRows.size()-2).split(",");
QVERIFY(startDate <= QDate::fromString(dataRow[0], "yyyy-MM-dd"));
Asset *a = SessionBuilder::getInstance()->buildAsset("Gogolea");
QVERIFY(a->getFile() == "../Examples/Gogolea_test.csv");
QVERIFY(a->getStartDate() == startDate);
QVERIFY(a->getEndDate() == endDate);
QVERIFY(a->getName() == "Gogolea");
QVERIFY(a->getOrigin() == "Yahoo");
QVERIFY(AssetsFactory::getInstance()->retrieveAsset("Gogolea") != NULL);
//Verify the day of week
int size = dataRows.size();
for (int x =1; x < size; x++) {
dataRow = dataRows.at(x).split(",");
QVERIFY((QDate::fromString(dataRow[0], "yyyy-MM-dd").dayOfWeek() <= 5));
}
// Deletes the database file:
QFile databaseFile(SessionSaver::getInstance()->getDatabaseFile());
databaseFile.remove();
}