Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SlotMachine-Public
privacyengine-container
Commits
d8a1184a
Commit
d8a1184a
authored
Oct 04, 2022
by
Florian Wohner
Browse files
update clearing test
parent
e0bfe2bd
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.py
View file @
d8a1184a
...
...
@@ -130,8 +130,19 @@ def test_clearing():
base_s
=
sum
(
base
)
opt_s
=
sum
(
opt
)
diff
=
opt_s
-
base_s
numerators
=
[
b
*
diff
for
b
in
base
]
fractions
=
[
num
//
base_s
for
num
in
numerators
]
res
=
[
o
-
b
-
f
for
o
,
b
,
f
in
zip
(
opt
,
base
,
fractions
)]
numerators
=
[(
b
*
diff
)
+
1
for
b
in
base
]
fractions
=
[]
rest
=
0
for
numerator
in
numerators
:
div
=
numerator
//
base_s
mod
=
numerator
%
base_s
rest
+=
mod
if
rest
>
base_s
:
fractions
.
append
(
div
+
1
)
rest
-=
base_s
else
:
fractions
.
append
(
div
)
res
=
[
-
(
o
-
b
-
f
)
for
o
,
b
,
f
in
zip
(
opt
,
base
,
fractions
)]
comp
=
{
k
:
sum
([
res
[
i
]
for
i
in
v
])
for
k
,
v
in
mapping
.
items
()}
assert
json
[
"values"
]
==
comp
assert
sum
(
res
)
==
0
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment