Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
2026649f
Commit
2026649f
authored
Dec 23, 2010
by
Vladimir Dudnik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cosmetic changes, removed trailing spaces
parent
46d4975b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
13 deletions
+69
-13
cxts.cpp
tests/cxts/cxts.cpp
+69
-13
No files found.
tests/cxts/cxts.cpp
View file @
2026649f
...
...
@@ -643,11 +643,15 @@ int CvTest::read_params( CvFileStorage* fs )
{
int
code
=
0
;
if
(
fs
==
NULL
)
return
code
;
if
(
fs
==
NULL
)
return
code
;
if
(
ts
->
get_testing_mode
()
==
CvTS
::
TIMING_MODE
)
{
timing_param_names
=
find_param
(
fs
,
"timing_params"
);
if
(
!
timing_param_names
)
return
code
;
if
(
CV_NODE_IS_SEQ
(
timing_param_names
->
tag
)
)
{
CvSeq
*
seq
=
timing_param_names
->
data
.
seq
;
...
...
@@ -702,7 +706,7 @@ int CvTest::read_params( CvFileStorage* fs )
}
int
CvTest
::
get_next_timing_param_tuple
()
int
CvTest
::
get_next_timing_param_tuple
(
void
)
{
bool
increment
;
int
i
;
...
...
@@ -868,9 +872,12 @@ void CvTest::run( int start_from )
{
t0
=
cv
::
getTickCount
();
t2
=
cv
::
getCPUTickCount
();
run_func
();
t3
=
cv
::
getCPUTickCount
();
t1
=
cv
::
getTickCount
();
if
(
ts
->
get_err_code
()
<
0
)
return
;
...
...
@@ -880,8 +887,10 @@ void CvTest::run( int start_from )
if
(
i
==
0
)
t00
=
t0
;
v_cpe
.
push_back
((
double
)(
t3
-
t2
));
v_time
.
push_back
((
double
)(
t1
-
t0
));
if
(
i
>=
5
&&
t1
-
t00
>
freq
*
5
)
break
;
}
...
...
@@ -891,6 +900,7 @@ void CvTest::run( int start_from )
t_cpu_acc
=
v_cpe
[
i
/
2
];
t_acc
=
v_time
[
i
/
2
];
print_time
(
test_case_idx
,
t_acc
,
t_cpu_acc
);
}
else
...
...
@@ -903,6 +913,7 @@ void CvTest::run( int start_from )
continue
;
run_func
();
if
(
ts
->
get_err_code
()
<
0
)
return
;
...
...
@@ -913,13 +924,13 @@ void CvTest::run( int start_from )
}
void
CvTest
::
run_func
()
void
CvTest
::
run_func
(
void
)
{
assert
(
0
);
}
int
CvTest
::
get_test_case_count
()
int
CvTest
::
get_test_case_count
(
void
)
{
return
test_case_count
;
}
...
...
@@ -972,7 +983,7 @@ CvBadArgTest::CvBadArgTest( const char* _test_name, const char* _test_funcs, con
freq
=
cv
::
getTickFrequency
();
}
CvBadArgTest
::~
CvBadArgTest
()
CvBadArgTest
::~
CvBadArgTest
(
void
)
{
}
...
...
@@ -994,6 +1005,7 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
int
errcount
=
0
;
bool
thrown
=
false
;
if
(
!
descr
)
descr
=
""
;
...
...
@@ -1001,6 +1013,7 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
{
run_func
();
}
catch
(
const
cv
::
Exception
&
e
)
{
thrown
=
true
;
...
...
@@ -1011,6 +1024,7 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
errcount
=
1
;
}
}
catch
(...)
{
thrown
=
true
;
...
...
@@ -1018,6 +1032,7 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
descr
,
test_case_idx
);
errcount
=
1
;
}
if
(
!
thrown
)
{
ts
->
printf
(
CvTS
::
LOG
,
"%s (test case #%d): no expected exception was thrown
\n
"
,
...
...
@@ -1029,6 +1044,7 @@ int CvBadArgTest::run_test_case( int expected_code, const char* descr )
return
errcount
;
}
/*****************************************************************************************\
* Base Class for Test System *
\*****************************************************************************************/
...
...
@@ -1041,27 +1057,34 @@ CvTS::CvTS(const char* _module_name)
start_time
=
0
;
version
=
CV_TS_VERSION
;
memory_manager
=
0
;
/*
memory_manager = new CvTestMemoryManager(this);
cvSetMemoryManager( CvTestMemoryManager::alloc_proxy,
CvTestMemoryManager::free_proxy,
memory_manager );*/
ostrm_suffixes
[
SUMMARY_IDX
]
=
".sum"
;
ostrm_suffixes
[
LOG_IDX
]
=
".log"
;
ostrm_suffixes
[
CSV_IDX
]
=
".csv"
;
ostrm_suffixes
[
CONSOLE_IDX
]
=
0
;
ostrm_base_name
=
0
;
memset
(
output_streams
,
0
,
sizeof
(
output_streams
)
);
memset
(
&
params
,
0
,
sizeof
(
params
)
);
selected_tests
=
new
CvTestPtrVec
();
failed_tests
=
new
CvTestInfoVec
();
written_params
=
new
CvTestPtrVec
();
clear
();
}
return
;
}
// ctor
void
CvTS
::
clear
()
void
CvTS
::
clear
(
void
)
{
int
i
;
CvTest
*
test
;
...
...
@@ -1089,14 +1112,18 @@ void CvTS::clear()
}
output_streams
[
i
].
enable
=
1
;
}
cvReleaseFileStorage
(
&
fs
);
selected_tests
->
clear
();
failed_tests
->
clear
();
if
(
ostrm_base_name
)
{
free
(
ostrm_base_name
);
ostrm_base_name
=
0
;
}
params
.
rng_seed
=
0
;
params
.
debug_mode
=
-
1
;
params
.
print_only_failed
=
0
;
...
...
@@ -1109,10 +1136,10 @@ void CvTS::clear()
if
(
memory_manager
)
memory_manager
->
clear_and_check
();
}
}
// clear()
CvTS
::~
CvTS
()
CvTS
::~
CvTS
(
void
)
{
clear
();
set_data_path
(
0
);
...
...
@@ -1126,7 +1153,9 @@ CvTS::~CvTS()
delete
selected_tests
;
delete
failed_tests
;
}
return
;
}
// dtor
const
char
*
CvTS
::
str_from_code
(
int
code
)
...
...
@@ -1232,8 +1261,9 @@ typedef struct CvTsParamVal
{
const
char
*
fullname
;
const
void
*
val
;
}
CvTsParamVal
;
}
CvTsParamVal
;
int
CvTS
::
find_written_param
(
CvTest
*
test
,
const
char
*
paramname
,
int
valtype
,
const
void
*
val
)
{
...
...
@@ -1387,12 +1417,14 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
printf
(
LOG
,
"ERROR: output config name is not specified
\n
"
);
return
-
1
;
}
fs
=
cvOpenFileStorage
(
config_name
,
0
,
CV_STORAGE_WRITE
);
if
(
!
fs
)
{
printf
(
LOG
,
"ERROR: could not open config file %s
\n
"
,
config_name
);
return
-
1
;
}
cvWriteComment
(
fs
,
CV_TS_VERSION
" config file"
,
0
);
cvStartWriteStruct
(
fs
,
"common"
,
CV_NODE_MAP
);
write_default_params
(
fs
);
...
...
@@ -1403,10 +1435,13 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
test
=
(
CvTest
*
)
all_tests
[
i
];
if
(
!
(
test
->
get_support_testing_modes
()
&
get_testing_mode
())
)
continue
;
test
->
write_defaults
(
this
);
test
->
clear
();
}
cvReleaseFileStorage
(
&
fs
);
return
0
;
}
...
...
@@ -1507,6 +1542,7 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
if
(
memory_manager
)
memory_manager
->
start_tracking
();
update_context
(
test
,
-
1
,
true
);
current_test_info
.
rng_seed0
=
current_test_info
.
rng_seed
;
...
...
@@ -1523,7 +1559,9 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
current_test_info
.
rng_seed
=
temp
.
rng_seed
;
current_test_info
.
base_alloc_index
=
temp
.
base_alloc_index
;
}
test
->
clear
();
if
(
memory_manager
)
memory_manager
->
stop_tracking_and_check
();
...
...
@@ -1577,14 +1615,16 @@ int CvTS::run( int argc, char** argv, const char** blacklist )
test
->
safe_run
(
info
.
test_case_idx
);
}
}
int
nfailed
=
failed_tests
?
(
int
)
failed_tests
->
size
()
:
0
;
clear
();
return
nfailed
;
}
void
CvTS
::
print_help
()
void
CvTS
::
print_help
(
void
)
{
::
printf
(
"Usage: <test_executable> [{-h|--help}][-l] [-r] [-w] [-t] [-f <config_name>] [-d <data_path>] [-O{0|1}] [-tn <test_name>]
\n\n
"
...
...
@@ -1620,39 +1660,53 @@ const char* default_data_path = "../../../../tests/cv/testdata/";
int
CvTS
::
read_params
(
CvFileStorage
*
fs
)
{
CvFileNode
*
node
=
fs
?
cvGetFileNodeByName
(
fs
,
0
,
"common"
)
:
0
;
if
(
params
.
debug_mode
<
0
)
params
.
debug_mode
=
cvReadIntByName
(
fs
,
node
,
"debug_mode"
,
1
)
!=
0
;
if
(
params
.
skip_header
<
0
)
params
.
skip_header
=
cvReadIntByName
(
fs
,
node
,
"skip_header"
,
0
)
>
0
;
if
(
params
.
ignore_blacklist
<
0
)
params
.
ignore_blacklist
=
cvReadIntByName
(
fs
,
node
,
"ignore_blacklist"
,
0
)
>
0
;
params
.
print_only_failed
=
cvReadIntByName
(
fs
,
node
,
"print_only_failed"
,
0
)
!=
0
;
params
.
rerun_failed
=
cvReadIntByName
(
fs
,
node
,
"rerun_failed"
,
0
)
!=
0
;
params
.
rerun_immediately
=
cvReadIntByName
(
fs
,
node
,
"rerun_immediately"
,
0
)
!=
0
;
const
char
*
str
=
cvReadStringByName
(
fs
,
node
,
"filter_mode"
,
"tests"
);
params
.
test_filter_mode
=
strcmp
(
str
,
"functions"
)
==
0
?
CHOOSE_FUNCTIONS
:
CHOOSE_TESTS
;
str
=
cvReadStringByName
(
fs
,
node
,
"test_mode"
,
params
.
test_mode
==
TIMING_MODE
?
"timing"
:
"correctness"
);
params
.
test_mode
=
strcmp
(
str
,
"timing"
)
==
0
||
strcmp
(
str
,
"performance"
)
==
0
?
TIMING_MODE
:
CORRECTNESS_CHECK_MODE
;
str
=
cvReadStringByName
(
fs
,
node
,
"timing_mode"
,
params
.
timing_mode
==
AVG_TIME
?
"avg"
:
"min"
);
params
.
timing_mode
=
strcmp
(
str
,
"average"
)
==
0
||
strcmp
(
str
,
"avg"
)
==
0
?
AVG_TIME
:
MIN_TIME
;
params
.
test_filter_pattern
=
params
.
test_filter_pattern
!=
0
&&
strlen
(
params
.
test_filter_pattern
)
>
0
?
params
.
test_filter_pattern
:
cvReadStringByName
(
fs
,
node
,
params
.
test_filter_mode
==
CHOOSE_FUNCTIONS
?
"functions"
:
"tests"
,
""
);
params
.
resource_path
=
cvReadStringByName
(
fs
,
node
,
"."
);
if
(
params
.
use_optimized
<
0
)
params
.
use_optimized
=
cvReadIntByName
(
fs
,
node
,
"use_optimized"
,
-
1
);
if
(
!
params
.
data_path
||
!
params
.
data_path
[
0
]
)
{
const
char
*
data_path
=
cvReadStringByName
(
fs
,
node
,
"data_path"
,
default_data_path
);
set_data_path
(
data_path
);
}
params
.
test_case_count_scale
=
cvReadRealByName
(
fs
,
node
,
"test_case_count_scale"
,
1.
);
if
(
params
.
test_case_count_scale
<=
0
)
params
.
test_case_count_scale
=
1.
;
str
=
cvReadStringByName
(
fs
,
node
,
"seed"
,
0
);
if
(
str
&&
params
.
rng_seed
==
0
)
params
.
rng_seed
=
read_seed
(
str
);
...
...
@@ -1835,12 +1889,14 @@ void CvTS::printf( int streams, const char* fmt, ... )
}
}
void
CvTS
::
set_color
(
int
color
)
{
if
(
params
.
color_terminal
)
change_color
(
color
);
}
static
char
*
cv_strnstr
(
const
char
*
str
,
int
len
,
const
char
*
pattern
,
int
pattern_len
=
-
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment