disable some tests for the C++ target; refs #7870
This commit is contained in:
parent
c5c4da4f3c
commit
9a05fd9dcf
8 changed files with 25 additions and 44 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tclosure.nim"
|
target: "c"
|
||||||
output: '''
|
output: '''
|
||||||
1 3 6 11 20 foo
|
1 3 6 11 20 foo
|
||||||
foo88
|
foo88
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
target: "c"
|
||||||
|
"""
|
||||||
|
|
||||||
import coro
|
import coro
|
||||||
var
|
var
|
||||||
stackCheckValue = 1100220033
|
stackCheckValue = 1100220033
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
target: "c"
|
||||||
|
"""
|
||||||
|
|
||||||
import coro
|
import coro
|
||||||
|
|
||||||
var maxOccupiedMemory = 0
|
var maxOccupiedMemory = 0
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
discard """
|
||||||
|
target: "c"
|
||||||
|
"""
|
||||||
|
|
||||||
import coro
|
import coro
|
||||||
include system/timers
|
include system/timers
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
output: "Exit 1\nExit 2"
|
output: "Exit 1\nExit 2"
|
||||||
disabled: "macosx"
|
disabled: "macosx"
|
||||||
|
target: "c"
|
||||||
"""
|
"""
|
||||||
import coro
|
import coro
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,34 +0,0 @@
|
||||||
discard """
|
|
||||||
output: '''i: 1
|
|
||||||
success'''
|
|
||||||
"""
|
|
||||||
|
|
||||||
type
|
|
||||||
ESomething = object of Exception
|
|
||||||
ESomeOtherErr = object of Exception
|
|
||||||
|
|
||||||
proc genErrors(s: string) =
|
|
||||||
if s == "error!":
|
|
||||||
raise newException(ESomething, "Test")
|
|
||||||
else:
|
|
||||||
raise newException(EsomeotherErr, "bla")
|
|
||||||
|
|
||||||
proc foo() =
|
|
||||||
var i = 0
|
|
||||||
try:
|
|
||||||
inc i
|
|
||||||
onRaise(proc (e: ref Exception): bool =
|
|
||||||
echo "i: ", i)
|
|
||||||
genErrors("errssor!")
|
|
||||||
except ESomething:
|
|
||||||
echo("ESomething happened")
|
|
||||||
except:
|
|
||||||
echo("Some other error happened")
|
|
||||||
|
|
||||||
# test that raise handler is gone:
|
|
||||||
try:
|
|
||||||
genErrors("error!")
|
|
||||||
except ESomething:
|
|
||||||
echo "success"
|
|
||||||
|
|
||||||
foo()
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
discard """
|
discard """
|
||||||
file: "tgenscript.nim"
|
file: "tgenscript.nim"
|
||||||
|
target: "c"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
echo "--genscript"
|
echo "--genscript"
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
discard """
|
discard """
|
||||||
output: '''1 [2, 3, 4, 7]
|
output: '''1 [2, 3, 4, 7]
|
||||||
[0, 0]'''
|
[0, 0]'''
|
||||||
|
target: "c"
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Nim RTree and R*Tree implementation
|
# Nim RTree and R*Tree implementation
|
||||||
|
|
@ -81,13 +82,13 @@ proc distance(c1, c2: BoxCenter): auto =
|
||||||
proc overlap(r1, r2: Box): auto =
|
proc overlap(r1, r2: Box): auto =
|
||||||
result = type(r1[0].a)(1)
|
result = type(r1[0].a)(1)
|
||||||
for i in 0 .. r1.high:
|
for i in 0 .. r1.high:
|
||||||
result *= (min(r1[i]. b, r2[i]. b) - max(r1[i]. a, r2[i]. a))
|
result *= (min(r1[i].b, r2[i].b) - max(r1[i].a, r2[i].a))
|
||||||
if result <= 0: return 0
|
if result <= 0: return 0
|
||||||
|
|
||||||
proc union(r1, r2: Box): Box =
|
proc union(r1, r2: Box): Box =
|
||||||
for i in 0 .. r1.high:
|
for i in 0 .. r1.high:
|
||||||
result[i]. a = min(r1[i]. a, r2[i]. a)
|
result[i].a = min(r1[i].a, r2[i].a)
|
||||||
result[i]. b = max(r1[i]. b, r2[i]. b)
|
result[i].b = max(r1[i].b, r2[i].b)
|
||||||
|
|
||||||
proc intersect(r1, r2: Box): bool =
|
proc intersect(r1, r2: Box): bool =
|
||||||
for i in 0 .. r1.high:
|
for i in 0 .. r1.high:
|
||||||
|
|
@ -98,12 +99,12 @@ proc intersect(r1, r2: Box): bool =
|
||||||
proc area(r: Box): auto = #type(r[0].a) =
|
proc area(r: Box): auto = #type(r[0].a) =
|
||||||
result = type(r[0].a)(1)
|
result = type(r[0].a)(1)
|
||||||
for i in 0 .. r.high:
|
for i in 0 .. r.high:
|
||||||
result *= r[i]. b - r[i]. a
|
result *= r[i].b - r[i].a
|
||||||
|
|
||||||
proc margin(r: Box): auto = #type(r[0].a) =
|
proc margin(r: Box): auto = #type(r[0].a) =
|
||||||
result = type(r[0].a)(0)
|
result = type(r[0].a)(0)
|
||||||
for i in 0 .. r.high:
|
for i in 0 .. r.high:
|
||||||
result += r[i]. b - r[i]. a
|
result += r[i].b - r[i].a
|
||||||
|
|
||||||
# how much enlargement does r1 need to include r2
|
# how much enlargement does r1 need to include r2
|
||||||
proc enlargement(r1, r2: Box): auto =
|
proc enlargement(r1, r2: Box): auto =
|
||||||
|
|
@ -238,12 +239,12 @@ proc rstarSplit[M, D: Dim; RT, LT](t: RStarTree[M, D, RT, LT]; n: var Node[M, D,
|
||||||
for d2 in 0 ..< 2 * D:
|
for d2 in 0 ..< 2 * D:
|
||||||
let d = d2 div 2
|
let d = d2 div 2
|
||||||
if d2 mod 2 == 0:
|
if d2 mod 2 == 0:
|
||||||
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(x.b[d].a, y.b[d].a))
|
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(x.b[d].a, y.b[d].a))
|
||||||
else:
|
else:
|
||||||
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(x.b[d].b, y.b[d].b))
|
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(x.b[d].b, y.b[d].b))
|
||||||
for i in t.m - 1 .. n.a.high - t.m + 1:
|
for i in t.m - 1 .. n.a.high - t.m + 1:
|
||||||
var b = lx.b
|
var b = lx.b
|
||||||
for j in 0 ..< i: # we can precalculate union() for range 0 .. t.m - 1, but that seems to give no real benefit. Maybe for very large M?
|
for j in 0 ..< i: # we can precalculate union() for range 0 .. t.m - 1, but that seems to give no real benefit.Maybe for very large M?
|
||||||
#echo "x",j
|
#echo "x",j
|
||||||
b = union(n.a[j].b, b)
|
b = union(n.a[j].b, b)
|
||||||
var m = margin(b)
|
var m = margin(b)
|
||||||
|
|
@ -446,7 +447,7 @@ proc reInsert[M, D: Dim; RT, LT](t: RStarTree[M, D, RT, LT]; n: var Node[M, D, R
|
||||||
while p.a[i].n != n:
|
while p.a[i].n != n:
|
||||||
inc(i)
|
inc(i)
|
||||||
let c = center(p.a[i].b)
|
let c = center(p.a[i].b)
|
||||||
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(distance(center(x.b), c), distance(center(y.b), c)))
|
sortPlus(n.a, lx, proc (x, y: NL): int = cmp(distance(center(x.b), c), distance(center(y.b), c)))
|
||||||
n.numEntries = M - t.p
|
n.numEntries = M - t.p
|
||||||
swap(n.a[n.numEntries], lx)
|
swap(n.a[n.numEntries], lx)
|
||||||
inc n.numEntries
|
inc n.numEntries
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue