File tree Expand file tree Collapse file tree 1 file changed +3
-11
lines changed
Expand file tree Collapse file tree 1 file changed +3
-11
lines changed Original file line number Diff line number Diff line change 22Test scyjava JVM memory-related functions.
33"""
44
5- import math
6-
75from assertpy import assert_that
86
97import scyjava
108
11-
12- def magnitude (x : int ) -> int :
13- return math .floor (math .log10 (abs (x )))
14-
15-
169mb_initial = 50 # initial MB of memory to snarf up
10+ mb_tolerance = 10 # ceiling of expected MB in use
1711
1812scyjava .config .set_heap_min (mb = mb_initial )
1913scyjava .config .set_heap_max (gb = 1 )
@@ -35,9 +29,7 @@ def magnitude(x: int) -> int:
3529).is_less_than_or_equal_to (mb_max )
3630assert_that (mb_max , "maximum heap size should be approx. 1 GB" ).is_between (900 , 1024 )
3731
38- tolerance = pow (10 , magnitude (mb_initial ))
39-
40- assert_that (mb_used , "most memory should be available" ).is_less_than (tolerance )
32+ assert_that (mb_used , "most memory should be available" ).is_less_than (mb_tolerance )
4133assert_that (mb_total , "total memory should be close to initial" ).is_close_to (
42- mb_initial , tolerance = tolerance
34+ mb_initial , tolerance = mb_tolerance
4335)
You can’t perform that action at this time.
0 commit comments