Test system included into Android build
This commit is contained in:
@@ -103,7 +103,7 @@ CV_EXPORTS string fromUtf16(const WString& str);
|
||||
CV_EXPORTS WString toUtf16(const string& str);
|
||||
|
||||
CV_EXPORTS string format( const char* fmt, ... );
|
||||
|
||||
CV_EXPORTS string tempfile( const char* suffix CV_DEFAULT(0));
|
||||
|
||||
// matrix decomposition types
|
||||
enum { DECOMP_LU=0, DECOMP_SVD=1, DECOMP_EIG=2, DECOMP_CHOLESKY=3, DECOMP_QR=4, DECOMP_NORMAL=16 };
|
||||
|
@@ -349,6 +349,23 @@ string format( const char* fmt, ... )
|
||||
return string(buf);
|
||||
}
|
||||
|
||||
string tempfile( const char* suffix )
|
||||
{
|
||||
char buf[L_tmpnam];
|
||||
char* name = 0;
|
||||
#if ANDROID
|
||||
strcpy(buf, "/sdcard/__opencv_temp_XXXXXX");
|
||||
name = mktemp(buf);
|
||||
#else
|
||||
name = tmpnam(buf);
|
||||
#endif
|
||||
if (*name == '\\')
|
||||
++name;
|
||||
if (suffix != 0)
|
||||
return string(buf) + suffix;
|
||||
return buf;
|
||||
}
|
||||
|
||||
static CvErrorCallback customErrorCallback = 0;
|
||||
static void* customErrorCallbackData = 0;
|
||||
static bool breakOnError = false;
|
||||
|
@@ -102,13 +102,9 @@ protected:
|
||||
|
||||
cvClearMemStorage(storage);
|
||||
|
||||
char buf[L_tmpnam+16];
|
||||
char* filename = tmpnam(buf);
|
||||
strcat(filename, idx % 2 ? ".yml" : ".xml");
|
||||
if(filename[0] == '\\')
|
||||
filename++;
|
||||
string filename = tempfile(idx % 2 ? ".yml" : ".xml");
|
||||
|
||||
FileStorage fs(filename, FileStorage::WRITE);
|
||||
FileStorage fs(filename.c_str(), FileStorage::WRITE);
|
||||
|
||||
int test_int = (int)cvtest::randInt(rng);
|
||||
double test_real = (cvtest::randInt(rng)%2?1:-1)*exp(cvtest::randReal(rng)*18-9);
|
||||
@@ -185,9 +181,9 @@ protected:
|
||||
|
||||
fs.release();
|
||||
|
||||
if(!fs.open(filename, FileStorage::READ))
|
||||
if(!fs.open(filename.c_str(), FileStorage::READ))
|
||||
{
|
||||
ts->printf( cvtest::TS::LOG, "filename %s can not be read\n", filename );
|
||||
ts->printf( cvtest::TS::LOG, "filename %s can not be read\n", filename.c_str() );
|
||||
ts->set_failed_test_info( cvtest::TS::FAIL_MISSING_TEST_DATA );
|
||||
return;
|
||||
}
|
||||
@@ -374,7 +370,7 @@ protected:
|
||||
}
|
||||
|
||||
fs.release();
|
||||
remove(filename);
|
||||
remove(filename.c_str());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user