make tests green again

This commit is contained in:
Andreas Rumpf
2017-10-01 07:46:13 +02:00
parent e8eb496e6f
commit 68c7da227f
2 changed files with 13 additions and 13 deletions

View File

@@ -58,10 +58,10 @@ proc create(T: typedesc): T =
result.vtbl = getVTable(T)
proc baseFoo(o: var TBase): int =
return cast[fooProc[TBase]](o.vtbl[0]) (o)
return cast[fooProc[TBase]](o.vtbl[0])(o)
proc baseBar(o: var TBase) =
cast[barProc[TBase]](o.vtbl[1]) (o)
cast[barProc[TBase]](o.vtbl[1])(o)
var a = TUserObject1.create
var b = TUserObject2.create

View File

@@ -20,38 +20,38 @@ proc `*` (a, b: TComplex): TComplex =
proc abs2 (a: TComplex): float =
return a.re * a.re + a.im * a.im
var size = parseInt (paramStr (1))
var size = parseInt(paramStr(1))
var bit = 128
var byteAcc = 0
stdout.writeLine ("P4")
stdout.write ($size)
stdout.write (" ")
stdout.writeLine ($size)
stdout.writeLine("P4")
stdout.write($size)
stdout.write(" ")
stdout.writeLine($size)
var fsize = float (size)
var fsize = float(size)
for y in 0 .. size-1:
var fy = 2.0 * float (y) / fsize - 1.0
var fy = 2.0 * float(y) / fsize - 1.0
for x in 0 .. size-1:
var z = (0.0, 0.0)
var c = (float (2*x) / fsize - 1.5, fy)
var c = (float(2*x) / fsize - 1.5, fy)
block iter:
for i in 0 .. 49:
z = z*z + c
if abs2 (z) >= 4.0:
if abs2(z) >= 4.0:
break iter
byteAcc = byteAcc + bit
if bit > 1:
bit = bit div 2
else:
stdout.write (chr (byteAcc))
stdout.write(chr(byteAcc))
bit = 128
byteAcc = 0
if bit != 128:
stdout.write (chr (byteAcc))
stdout.write(chr(byteAcc))
bit = 128
byteAcc = 0