diff options
Diffstat (limited to 'tests/parallel/tconvexhull.nim')
-rw-r--r-- | tests/parallel/tconvexhull.nim | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/tests/parallel/tconvexhull.nim b/tests/parallel/tconvexhull.nim index dffe5339b..a89aa910b 100644 --- a/tests/parallel/tconvexhull.nim +++ b/tests/parallel/tconvexhull.nim @@ -1,12 +1,7 @@ discard """ - output: '''true -true -true -true -true -true''' - -ccodeCheck: "\\i ! @'deepCopy(' .*" + matrix: "--mm:refc" + output: ''' +''' """ # parallel convex hull for Nim bigbreak @@ -20,10 +15,10 @@ proc cmpPoint(a, b: Point): int = if result == 0: result = cmp(a.y, b.y) -template cross[T](o, a, b: T): expr = +template cross[T](o, a, b: T): untyped = (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x) -template pro(): expr = +template pro(): untyped = while lr1 > 0 and cross(result[lr1 - 1], result[lr1], p[i]) <= 0: discard result.pop lr1 -= 1 @@ -55,10 +50,11 @@ proc convex_hull[T](points: var seq[T], cmp: proc(x, y: T): int {.closure.}) : s ul[k] = spawn half[T](points, k == 0) result = concat(^ul[0], ^ul[1]) -var s = map(toSeq(0..999999), proc(x: int): Point = (float(x div 1000), float(x mod 1000))) +var s = map(toSeq(0..9999), proc(x: int): Point = (float(x div 100), float(x mod 100))) +# On some runs, this pool size reduction will set the "shutdown" attribute on the +# worker thread that executes our spawned task, before we can read the flowvars. setMaxPoolSize 2 -#echo convex_hull[Point](s, cmpPoint) -for i in 0..5: - echo convex_hull[Point](s, cmpPoint) == - @[(0.0, 0.0), (999.0, 0.0), (999.0, 999.0), (0.0, 999.0)] +for i in 0..2: + doAssert convex_hull[Point](s, cmpPoint) == + @[(0.0, 0.0), (99.0, 0.0), (99.0, 99.0), (0.0, 99.0)] |