Skip to content

Commit 9279e09

Browse files
committed
Switch to rounding
1 parent 70ca90a commit 9279e09

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

scripts/hpc-ratchet

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,15 @@ TOP_LEVEL_DECLS = 'top_level_decls'
3232
3333
In a just world, this would be a separate config file, or command-line arguments.
3434
35-
We round (truncate) coverage ratios to three decimals before comparing, so
36-
there's no need to go more than that.
37-
35+
We round coverage ratios to three decimals before comparing,
36+
so there's no need to go more than that.
3837
"""
3938
DESIRED_COVERAGE = {
4039
EXPRESSIONS: 0.571,
41-
BOOLEANS: 0.473,
40+
BOOLEANS: 0.474,
4241
ALTERNATIVES: 0.453,
43-
LOCAL_DECLS: 0.813,
44-
TOP_LEVEL_DECLS: 0.33,
42+
LOCAL_DECLS: 0.814,
43+
TOP_LEVEL_DECLS: 0.331,
4544
}
4645

4746
DEFAULT_PRECISION = 3
@@ -144,8 +143,8 @@ def compare_values((covered, total), target, precision=DEFAULT_PRECISION):
144143
"""
145144
actual = covered / total
146145
scale = 10 ** precision
147-
rounded_actual = int(actual * scale)
148-
rounded_target = int(target * scale)
146+
rounded_actual = int(round(actual * scale))
147+
rounded_target = int(round(target * scale))
149148
return cmp(rounded_actual, rounded_target)
150149

151150

0 commit comments

Comments
 (0)