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
a46da863
Commit
a46da863
authored
Aug 05, 2011
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Java API: fixed script for coverage calculation
parent
39c5eb2f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
6 deletions
+39
-6
check-tests.py
modules/java/check-tests.py
+39
-6
No files found.
modules/java/check-tests.py
View file @
a46da863
...
@@ -4,12 +4,13 @@ classes_ignore_list = (
...
@@ -4,12 +4,13 @@ classes_ignore_list = (
'OpenCV(Test)?Case'
,
'OpenCV(Test)?Case'
,
'OpenCV(Test)?Runner'
,
'OpenCV(Test)?Runner'
,
'CvException'
,
'CvException'
,
'CvType'
)
)
funcs_ignore_list
=
(
funcs_ignore_list
=
(
'
\
w+--HashCode'
,
'
\
w+--HashCode'
,
'Mat--MatLong'
,
'Mat--MatLong'
,
'
\
w+--Equals'
,
'Core--MinMaxLocResult'
,
)
)
class
JavaParser
:
class
JavaParser
:
...
@@ -19,6 +20,8 @@ class JavaParser:
...
@@ -19,6 +20,8 @@ class JavaParser:
def
clear
(
self
):
def
clear
(
self
):
self
.
mdict
=
{}
self
.
mdict
=
{}
self
.
tdict
=
{}
self
.
tdict
=
{}
self
.
mwhere
=
{}
self
.
twhere
=
{}
self
.
empty_stubs_cnt
=
0
self
.
empty_stubs_cnt
=
0
self
.
r1
=
re
.
compile
(
"
\
s*public
\
s+(?:static
\
s+)?(
\
w+)
\
(([^)]*)
\
)"
)
# c-tor
self
.
r1
=
re
.
compile
(
"
\
s*public
\
s+(?:static
\
s+)?(
\
w+)
\
(([^)]*)
\
)"
)
# c-tor
self
.
r2
=
re
.
compile
(
"
\
s*(?:(?:public|static|final)
\
s+){1,3}
\
S+
\
s+(
\
w+)
\
(([^)]*)
\
)"
)
self
.
r2
=
re
.
compile
(
"
\
s*(?:(?:public|static|final)
\
s+){1,3}
\
S+
\
s+(
\
w+)
\
(([^)]*)
\
)"
)
...
@@ -47,28 +50,52 @@ class JavaParser:
...
@@ -47,28 +50,52 @@ class JavaParser:
def
get_not_tested
(
self
):
def
get_not_tested
(
self
):
mset
=
self
.
dict2set
(
self
.
mdict
)
mset
=
self
.
dict2set
(
self
.
mdict
)
tset
=
self
.
dict2set
(
self
.
tdict
)
tset
=
self
.
dict2set
(
self
.
tdict
)
return
mset
-
tset
nottested
=
mset
-
tset
out
=
set
()
for
name
in
nottested
:
out
.
add
(
name
+
" "
+
self
.
mwhere
[
name
])
return
out
def
parse
(
self
,
path
):
def
parse
(
self
,
path
):
if
".svn"
in
path
:
if
".svn"
in
path
:
return
return
if
os
.
path
.
isfile
(
path
):
if
os
.
path
.
isfile
(
path
):
parser
.
parse_file
(
path
)
if
path
.
endswith
(
"FeatureDetector.java"
):
for
prefix1
in
(
""
,
"Grid"
,
"Pyramid"
,
"Dynamic"
):
for
prefix2
in
(
"FAST"
,
"STAR"
,
"MSER"
,
"ORB"
,
"SIFT"
,
"SURF"
,
"GFTT"
,
"HARRIS"
):
parser
.
parse_file
(
path
,
prefix1
+
prefix2
)
elif
path
.
endswith
(
"DescriptorExtractor.java"
):
for
prefix1
in
(
""
,
"Opponent"
):
for
prefix2
in
(
"BRIEF"
,
"ORB"
,
"SIFT"
,
"SURF"
):
parser
.
parse_file
(
path
,
prefix1
+
prefix2
)
elif
path
.
endswith
(
"GenericDescriptorMatcher.java"
):
for
prefix
in
(
"OneWay"
,
"Fern"
):
parser
.
parse_file
(
path
,
prefix
)
elif
path
.
endswith
(
"DescriptorMatcher.java"
):
for
prefix
in
(
"BruteForce"
,
"BruteForceHamming"
,
"BruteForceHammingLUT"
,
"BruteForceL1"
,
"FlannBased"
):
parser
.
parse_file
(
path
,
prefix
)
else
:
parser
.
parse_file
(
path
)
elif
os
.
path
.
isdir
(
path
):
elif
os
.
path
.
isdir
(
path
):
for
x
in
os
.
listdir
(
path
):
for
x
in
os
.
listdir
(
path
):
self
.
parse
(
path
+
"/"
+
x
)
self
.
parse
(
path
+
"/"
+
x
)
return
return
def
parse_file
(
self
,
fname
):
def
parse_file
(
self
,
fname
,
prefix
=
""
):
istest
=
fname
.
endswith
(
"Test.java"
)
clsname
=
os
.
path
.
basename
(
fname
)
.
replace
(
"Test"
,
""
)
.
replace
(
".java"
,
""
)
clsname
=
os
.
path
.
basename
(
fname
)
.
replace
(
"Test"
,
""
)
.
replace
(
".java"
,
""
)
clsname
=
clsname
[
0
]
.
upper
()
+
clsname
[
1
:]
clsname
=
prefix
+
clsname
[
0
]
.
upper
()
+
clsname
[
1
:]
for
cls
in
classes_ignore_list
:
for
cls
in
classes_ignore_list
:
if
re
.
match
(
cls
,
clsname
):
if
re
.
match
(
cls
,
clsname
):
return
return
f
=
open
(
fname
,
"rt"
)
f
=
open
(
fname
,
"rt"
)
linenum
=
0
for
line
in
f
:
for
line
in
f
:
linenum
+=
1
m1
=
self
.
r1
.
match
(
line
)
m1
=
self
.
r1
.
match
(
line
)
m2
=
self
.
r2
.
match
(
line
)
m2
=
self
.
r2
.
match
(
line
)
m3
=
self
.
r3
.
match
(
line
)
m3
=
self
.
r3
.
match
(
line
)
...
@@ -89,13 +116,16 @@ class JavaParser:
...
@@ -89,13 +116,16 @@ class JavaParser:
#if "public" in line:
#if "public" in line:
#print "UNRECOGNIZED: " + line
#print "UNRECOGNIZED: " + line
continue
continue
d
=
(
self
.
mdict
,
self
.
tdict
)[
"test"
in
func
]
d
=
(
self
.
mdict
,
self
.
tdict
)[
istest
]
w
=
(
self
.
mwhere
,
self
.
twhere
)[
istest
]
func
=
re
.
sub
(
r"^test"
,
""
,
func
)
func
=
re
.
sub
(
r"^test"
,
""
,
func
)
func
=
clsname
+
"--"
+
func
[
0
]
.
upper
()
+
func
[
1
:]
func
=
clsname
+
"--"
+
func
[
0
]
.
upper
()
+
func
[
1
:]
args_str
=
args_str
.
replace
(
"[]"
,
"Array"
)
.
replace
(
"..."
,
"Array "
)
args_str
=
args_str
.
replace
(
"[]"
,
"Array"
)
.
replace
(
"..."
,
"Array "
)
args_str
=
re
.
sub
(
r"List<(\w+)>"
,
"ListOf
\
g<1>"
,
args_str
)
args_str
=
re
.
sub
(
r"List<(\w+)>"
,
"ListOf
\
g<1>"
,
args_str
)
args_str
=
re
.
sub
(
r"List<(\w+)>"
,
"ListOf
\
g<1>"
,
args_str
)
args
=
[
a
.
split
()[
0
]
for
a
in
args_str
.
split
(
","
)
if
a
]
args
=
[
a
.
split
()[
0
]
for
a
in
args_str
.
split
(
","
)
if
a
]
func_ex
=
func
+
""
.
join
([
a
[
0
]
.
upper
()
+
a
[
1
:]
for
a
in
args
])
func_ex
=
func
+
""
.
join
([
a
[
0
]
.
upper
()
+
a
[
1
:]
for
a
in
args
])
func_loc
=
fname
+
" (line: "
+
str
(
linenum
)
+
")"
skip
=
False
skip
=
False
for
fi
in
funcs_ignore_list
:
for
fi
in
funcs_ignore_list
:
if
re
.
match
(
fi
,
func_ex
):
if
re
.
match
(
fi
,
func_ex
):
...
@@ -107,6 +137,9 @@ class JavaParser:
...
@@ -107,6 +137,9 @@ class JavaParser:
d
[
func
]
.
append
(
func_ex
)
d
[
func
]
.
append
(
func_ex
)
else
:
else
:
d
[
func
]
=
[
func_ex
]
d
[
func
]
=
[
func_ex
]
w
[
func_ex
]
=
func_loc
w
[
func
]
=
func_loc
f
.
close
()
f
.
close
()
return
return
...
...
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