summary refs log tree commit diff stats
path: root/tests/converter
diff options
context:
space:
mode:
authorArne Döring <arne.doering@gmx.net>2019-02-12 22:00:31 +0100
committerAndreas Rumpf <rumpf_a@web.de>2019-02-13 23:30:14 +0100
commit28394153aba1e1ec0410406392e26e1e7e2e681e (patch)
tree0f2f455db7375b8e2c1e57b56a7f7d950d955bab /tests/converter
parent304b1dd34bc52df29528c2a12f769cb59904db5a (diff)
downloadNim-28394153aba1e1ec0410406392e26e1e7e2e681e.tar.gz
32 bit fixes (#10608)
Diffstat (limited to 'tests/converter')
-rw-r--r--tests/converter/tgenericconverter2.nim36
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/converter/tgenericconverter2.nim b/tests/converter/tgenericconverter2.nim
index 017651a6b..6d1d3d859 100644
--- a/tests/converter/tgenericconverter2.nim
+++ b/tests/converter/tgenericconverter2.nim
@@ -1,6 +1,8 @@
 # bug #3799
-discard """
-output: '''
+
+import strutils
+
+const output = splitLines("""
 00000000000000000000000000000000000000000
 00000000000001111111111111110000000000000
 00000000001111111111111111111110000000000
@@ -28,11 +30,7 @@ output: '''
 00000000111111111111111111111111100000000
 00000000000111111111111111111100000000000
 00000000000000111111111111100000000000000
-'''
-"""
-
-
-import macros
+""")
 
 const nmax = 500
 
@@ -63,19 +61,25 @@ proc julia*[T](z0, c: Complex[T], er2: T, nmax: int): int =
 template dendriteFractal*[T](z0: Complex[T], er2: T, nmax: int): int =
   julia(z0, (T(0.0), T(1.0)), er2, nmax)
 
-iterator stepIt[T](start, step: T, iterations: int): T =
+iterator stepIt[T](start, step: T, iterations: int): (int, T) =
   for i in 0 .. iterations:
-    yield start + T(i) * step
+    yield (i, start + T(i) * step)
 
+var errors = 0
 
 let c = (0.36237, 0.32)
-for y in stepIt(2.0, -0.0375 * 4, 107 div 4):
+for j, y in stepIt(2.0, -0.0375 * 4, 107 div 4):
   var row = ""
-  for x in stepIt(-2.0, 0.025 * 4, 160 div 4):
+  for i, x in stepIt(-2.0, 0.025 * 4, 160 div 4):
     #let n = julia((x, y), c, 4.0, nmax)         ### this works
     let n = dendriteFractal((x, y), 4.0, nmax)
-    if n < nmax:
-      row.add($(n mod 10))
-    else:
-      row.add(' ')
-  echo row
+    let c = char(int('0') + n mod 10)
+    let e = output[j][i]  # expected
+    if c != e:
+      errors += 1
+    row.add(c)
+
+  # Printing aparently makes the test fail when joined.
+  # echo row
+
+doAssert errors < 10, "total errors: " & $errors