Skip to content

Commit

Permalink
solve warnings and errors in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
wiryls committed Jun 24, 2016
1 parent 7c92ee2 commit 959002f
Showing 1 changed file with 23 additions and 12 deletions.
35 changes: 23 additions & 12 deletions modules/core/test/test_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,22 +588,23 @@ class CV_Base64IOTest : public cvtest::BaseTest
private:
std::string file_name;

struct data_t
{
uchar u1, u2;
int i1, i2, i3;
double d1, d2;
int i4;
};

public:
CV_Base64IOTest(std::string const & file_name)
: file_name(file_name) {}
CV_Base64IOTest(std::string const & test_file_name)
: file_name(test_file_name) {}
~CV_Base64IOTest() {}
protected:
void run(int)
{
try
{
struct data_t
{
uchar u1, u2;
int i1, i2, i3;
double d1, d2;
int i4;
};
std::vector<data_t> rawdata;

cv::Mat _em_out, _em_in;
Expand All @@ -629,8 +630,18 @@ class CV_Base64IOTest : public cvtest::BaseTest
_nd_out = _4d(ranges);

/* raw data */
for (int i = 0; i < 1000; i++)
rawdata.push_back(data_t{1, 2, 1, 2, 3, 0.1, 0.2, i});
for (int i = 0; i < 1000; i++) {
data_t tmp;
rawdata[i].u1 = 1;
rawdata[i].u2 = 2;
rawdata[i].i1 = 1;
rawdata[i].i2 = 2;
rawdata[i].i3 = 3;
rawdata[i].d1 = 0.1;
rawdata[i].d2 = 0.2;
rawdata[i].i4 = i;
rawdata.push_back(tmp);
}
}

{ /* write */
Expand All @@ -642,7 +653,7 @@ class CV_Base64IOTest : public cvtest::BaseTest
holder = _em_out;
cv::cvWriteMat_Base64(*fs, "empty_2d_mat", &holder);

cv::cvStartWriteRawData_Base64(*fs, "rawdata", rawdata.size(), "2u3i2di");
cv::cvStartWriteRawData_Base64(*fs, "rawdata", static_cast<int>(rawdata.size()), "2u3i2di");
for (int i = 0; i < 10; i++)
cv::cvWriteRawData_Base64(*fs, rawdata.data() + i * 100, 100);
cv::cvEndWriteRawData_Base64(*fs);
Expand Down

0 comments on commit 959002f

Please sign in to comment.