summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xlib/pure/algorithm.nim4
-rwxr-xr-xlib/system.nim8
-rwxr-xr-xtests/compile/tsortdev.nim8
3 files changed, 10 insertions, 10 deletions
diff --git a/lib/pure/algorithm.nim b/lib/pure/algorithm.nim
index 15b0129ad..1e9a0bb4b 100755
--- a/lib/pure/algorithm.nim
+++ b/lib/pure/algorithm.nim
@@ -35,12 +35,12 @@ proc reverse*[T](a: var openArray[T]) =
   reverse(a, 0, a.high)
 
 const
-  onlySafeCode = true
+  onlySafeCode = false
 
 proc merge[T](a, b: var openArray[T], lo, m, hi: int, 
               cmp: proc (x, y: T): int, order: TSortOrder) =
   template `<-` (a, b: expr) = 
-    when true:
+    when false:
       a = b
     elif onlySafeCode:
       shallowCopy(a, b)
diff --git a/lib/system.nim b/lib/system.nim
index d9d3ebd86..11188a4c0 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -2129,16 +2129,16 @@ template assert*(cond: expr, msg = "") =
   ## Use ``assert`` for debugging purposes only.
   bind raiseAssert, InstantiationInfo
   when compileOption("assertions"):
-    if not cond:
-      {.line.}:
+    {.line.}:
+      if not cond:
         raiseAssert(astToStr(cond) & ' ' & msg)
 
 template doAssert*(cond: expr, msg = "") =
   ## same as `assert` but is always turned on and not affected by the
   ## ``--assertions`` command line switch.
   bind raiseAssert, InstantiationInfo
-  if not cond:
-    {.line: InstantiationInfo().}:
+  {.line: InstantiationInfo().}:
+    if not cond:
       raiseAssert(astToStr(cond) & ' ' & msg)
 
 
diff --git a/tests/compile/tsortdev.nim b/tests/compile/tsortdev.nim
index 0af0fe0f4..baf238d9e 100755
--- a/tests/compile/tsortdev.nim
+++ b/tests/compile/tsortdev.nim
@@ -28,8 +28,8 @@ when isMainModule:
     var data: seq[string] = @[]
     
     var L = random(59)
-    for i in 0..1: 
-      echo "loop: ", i
+    for i in 0..10_000: 
+      #echo "loop: ", i
       #newSeq(data, L)
       setLen(data, L)
       for j in 0 .. L-1:
@@ -39,13 +39,13 @@ when isMainModule:
       var copy = data
       for j in 0 .. L-1:
         assert getRefcount(copy[j]) == 1
-        assert(cast[pointer](copy[j]) != cast[pointer](data[i]))
+        assert(cast[pointer](copy[j]) != cast[pointer](data[j]))
       
       bubblesort(data, system.cmp, order)
       if not sorted(data, order):
         quit "bubblesort failed"
 
-      sort(copy, cmp, order)
+      #sort(copy, cmp, order)
       for j in 0 .. L-1:
         let rc = getRefcount(data[j])
         if rc != 1: