Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Project_Phoenix
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LuFG VR VIS
VR-Group
Project_Phoenix
Commits
9240e15d
Commit
9240e15d
authored
7 years ago
by
aboensch
Browse files
Options
Downloads
Patches
Plain Diff
sort allow_calls_provided params in two subgroups: glew and gl
issue #483
parent
ff730cde
No related branches found
No related tags found
1 merge request
!155
Feature/#483 cleanup opengl mock
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/mocks/generation/CleanUp_openGL_mock.py
+18
-3
18 additions, 3 deletions
tests/src/mocks/generation/CleanUp_openGL_mock.py
with
18 additions
and
3 deletions
tests/src/mocks/generation/CleanUp_openGL_mock.py
+
18
−
3
View file @
9240e15d
...
@@ -21,13 +21,14 @@
...
@@ -21,13 +21,14 @@
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
import
textwrap
import
textwrap
import
os
import
os
from
collections
import
defaultdict
params_to_be_sorted
=
[
"
functions_to_mock
"
,
"
allow_calls_provided
"
,
params_to_be_sorted
=
[
"
functions_to_mock
"
,
"
allow_calls_provided
"
,
"
gl_types
"
]
"
gl_types
"
]
def
sortListAlphabetically
(
content
):
def
sortListAlphabetically
(
content
):
prefix
=
content
[
0
:
content
.
find
(
"
=
"
)]
prefix
=
content
[
0
:
content
.
find
(
"
=
"
)]
print
(
"
... sorting
prefix
"
+
prefix
)
print
(
"
... sorting
"
+
prefix
)
sub_content
=
content
[
content
.
find
(
"
[
"
)
+
1
:
content
.
find
(
"'
]
"
)]
sub_content
=
content
[
content
.
find
(
"
[
"
)
+
1
:
content
.
find
(
"'
]
"
)]
params
=
sub_content
.
split
(
"'
,
"
)
params
=
sub_content
.
split
(
"'
,
"
)
...
@@ -36,10 +37,24 @@ def sortListAlphabetically(content):
...
@@ -36,10 +37,24 @@ def sortListAlphabetically(content):
#else:
#else:
params
=
sorted
(
params
)
params
=
sorted
(
params
)
if
(
params_to_be_sorted
[
1
]
in
prefix
):
sub_content
=
SortGlewBeforeGl
(
params
)
else
:
sub_content
=
'
,
'
.
join
(
str
(
val
)
+
"'"
for
val
in
params
)
sub_content
=
'
,
'
.
join
(
str
(
val
)
+
"'"
for
val
in
params
)
return
(
prefix
+
"
= [
"
+
sub_content
+
"
]
"
)
return
(
prefix
+
"
= [
"
+
sub_content
+
"
]
"
)
def
SortGlewBeforeGl
(
params
):
d
=
defaultdict
(
list
)
for
val
in
params
:
d
[
"
glew
"
in
val
].
append
(
val
)
sortedParams
=
'
,
'
.
join
(
str
(
p
)
+
"'"
for
p
in
d
[
True
])
sortedParams
+=
'
,
'
sortedParams
+=
'
,
'
.
join
(
str
(
p
)
+
"'"
for
p
in
d
[
False
])
return
sortedParams
def
printToFile
(
file
,
content
):
def
printToFile
(
file
,
content
):
nr_of_blanks
=
len
(
content
[
0
:
content
.
find
(
"
[
"
)
+
1
])
nr_of_blanks
=
len
(
content
[
0
:
content
.
find
(
"
[
"
)
+
1
])
if
(
params_to_be_sorted
[
1
]
in
content
):
if
(
params_to_be_sorted
[
1
]
in
content
):
...
@@ -57,7 +72,7 @@ def printWithLineBreakAtComma(file, content, nr_of_blanks):
...
@@ -57,7 +72,7 @@ def printWithLineBreakAtComma(file, content, nr_of_blanks):
content
=
content
.
replace
(
"'
,
"
,
"'
,
\n
"
)
content
=
content
.
replace
(
"'
,
"
,
"'
,
\n
"
)
params
=
content
.
split
(
"
\n
"
)
params
=
content
.
split
(
"
\n
"
)
for
val
in
params
:
for
val
in
params
:
file
.
write
(
val
+
"
\n
"
if
val
==
params
[
0
]
else
'
'
*
(
nr_of_blanks
-
1
)
+
val
+
"
\n
"
)
file
.
write
(
val
+
"
\n
"
if
val
==
params
[
0
]
else
'
'
*
(
nr_of_blanks
)
+
val
+
"
\n
"
)
def
main
():
def
main
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment