diff options
Diffstat (limited to 'tests/parallel')
-rw-r--r-- | tests/parallel/tmissing_deepcopy.nim | 4 | ||||
-rw-r--r-- | tests/parallel/tsimple_array_checks.nim | 4 | ||||
-rw-r--r-- | tests/parallel/twrong_refcounts.nim | 56 |
3 files changed, 4 insertions, 60 deletions
diff --git a/tests/parallel/tmissing_deepcopy.nim b/tests/parallel/tmissing_deepcopy.nim index 694eb77db..94e027b60 100644 --- a/tests/parallel/tmissing_deepcopy.nim +++ b/tests/parallel/tmissing_deepcopy.nim @@ -26,9 +26,9 @@ proc greet(p:Person) = " friend:", p.friend.name, "(", cast[int](addr p.friend.name),") }" proc setup = - for i in 0 .. <20: + for i in 0 ..< 20: people.add newPerson("Person" & $(i + 1)) - for i in 0 .. <20: + for i in 0 ..< 20: people[i].friend = people[19-i] proc update = diff --git a/tests/parallel/tsimple_array_checks.nim b/tests/parallel/tsimple_array_checks.nim index 5d6e87efe..650b809e0 100644 --- a/tests/parallel/tsimple_array_checks.nim +++ b/tests/parallel/tsimple_array_checks.nim @@ -35,9 +35,9 @@ proc main = parallel: for n in nums: # Error: cannot prove: i <= len(nums) + -1 spawn log(n) - #for i in 0 .. <nums.len: # Error: cannot prove: i <= len(nums) + -1 + #for i in 0 ..< nums.len: # Error: cannot prove: i <= len(nums) + -1 #for i in 0 .. nums.len-1: # WORKS! - #for i in 0 .. <nums.len: # WORKS! + #for i in 0 ..< nums.len: # WORKS! # spawn log(nums[i]) # Array needs explicit size to work, probably related to issue #2287 diff --git a/tests/parallel/twrong_refcounts.nim b/tests/parallel/twrong_refcounts.nim deleted file mode 100644 index ed3c1b894..000000000 --- a/tests/parallel/twrong_refcounts.nim +++ /dev/null @@ -1,56 +0,0 @@ -discard """ - output: "Success" - target: "c" -""" - -# Note: target: "cpp" fails because we can't yet have `extern "C"` mangling in -# `exportc` procs. -import math, random, threadPool - -# --- - -type - Person = object - age: int - friend: ref Person - -var - people: seq[ref Person] = @[] - -proc newPerson(age:int): ref Person = - result.new() - result.age = age - -proc greet(p:Person) = - #echo p.age, ", ", p.friend.age - p.friend.age += 1 - -# --- - -proc setup = - for i in 0 .. <20: - people.add newPerson(i + 1) - for i in 0 .. <20: - people[i].friend = people[random(20)] - -proc update = - var countA: array[20, int] - var countB: array[20, int] - - for i, p in people: - countA[i] = getRefCount(p) - parallel: - for i in 0 .. people.high: - spawn greet(people[i][]) - for i, p in people: - countB[i] = getRefCount(p) - - for i in 0 .. <20: - doAssert countA[i] == countB[i] - echo "Success" - -# --- - -when true: - setup() - update() |