mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
* Solves #11156 * Check file size for all file format. Disable APPEND if file is empty * Add test for APPEND mode
This commit is contained in:
committed by
Vadim Pisarevsky
parent
75b5e3fa64
commit
03eb463f1c
@@ -602,6 +602,24 @@ TEST(Core_InputOutput, FileStorageSpaces)
|
||||
EXPECT_NO_THROW(f2[cv::format("key%d", i)] >> valuesRead[i]);
|
||||
ASSERT_STREQ(values[i].c_str(), valuesRead[i].c_str());
|
||||
}
|
||||
std::string fileName = cv::tempfile(".xml");
|
||||
cv::FileStorage g1(fileName, cv::FileStorage::WRITE);
|
||||
for (size_t i = 0; i < 2; i++) {
|
||||
EXPECT_NO_THROW(g1 << cv::format("key%d", i) << values[i]);
|
||||
}
|
||||
g1.release();
|
||||
cv::FileStorage g2(fileName, cv::FileStorage::APPEND);
|
||||
for (size_t i = 2; i < valueCount; i++) {
|
||||
EXPECT_NO_THROW(g2 << cv::format("key%d", i) << values[i]);
|
||||
}
|
||||
g2.release();
|
||||
cv::FileStorage g3(fileName, cv::FileStorage::READ);
|
||||
std::string valuesReadAppend[valueCount];
|
||||
for (size_t i = 0; i < valueCount; i++) {
|
||||
EXPECT_NO_THROW(g3[cv::format("key%d", i)] >> valuesReadAppend[i]);
|
||||
ASSERT_STREQ(values[i].c_str(), valuesReadAppend[i].c_str());
|
||||
}
|
||||
g3.release();
|
||||
}
|
||||
|
||||
struct data_t
|
||||
|
||||
Reference in New Issue
Block a user