summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-01-07 17:03:25 +0100
committerAndreas Rumpf <rumpf_a@web.de>2009-01-07 17:03:25 +0100
commit439aa2d04d5528b5aed288f70895515d1da2dc3d (patch)
treecda2d0bc4d4f2bab189c4a0567cae3c1428c5ed0 /tests
parent1c8ddca7e08af9075a930edaca6c522d5e6fd8b5 (diff)
downloadNim-439aa2d04d5528b5aed288f70895515d1da2dc3d.tar.gz
version 0.7.4
Diffstat (limited to 'tests')
-rw-r--r--tests/gtk/ex9.nim6
-rw-r--r--tests/readme.txt4
-rw-r--r--tests/thallo.nim31
-rw-r--r--tests/titer.nim10
-rw-r--r--tests/tlibs.nim3
-rw-r--r--tests/tnew.nim2
6 files changed, 43 insertions, 13 deletions
diff --git a/tests/gtk/ex9.nim b/tests/gtk/ex9.nim
index 79b335044..ce2f73862 100644
--- a/tests/gtk/ex9.nim
+++ b/tests/gtk/ex9.nim
@@ -25,9 +25,9 @@ stackbox = gtk_vbox_new(TRUE, 10)
 button1 = gtk_button_new_with_label("Move mouse over button")
 buttonstyle = gtk_style_copy(gtk_widget_get_style(Button1))
 ButtonStyle.bg[GTK_STATE_PRELIGHT].pixel = 0
-ButtonStyle.bg[GTK_STATE_PRELIGHT].red = 0x0000FFFF
-ButtonStyle.bg[GTK_STATE_PRELIGHT].blue = 0
-ButtonStyle.bg[GTK_STATE_PRELIGHT].green = 0
+ButtonStyle.bg[GTK_STATE_PRELIGHT].red = 0x0000FFFF'i16
+ButtonStyle.bg[GTK_STATE_PRELIGHT].blue = 0'i16
+ButtonStyle.bg[GTK_STATE_PRELIGHT].green = 0'i16
 gtk_widget_set_style(button1, buttonstyle)
 button2 = gtk_button_new()
 ALabel = gtk_label_new(Outside)
diff --git a/tests/readme.txt b/tests/readme.txt
index c8704f304..c21b04acd 100644
--- a/tests/readme.txt
+++ b/tests/readme.txt
@@ -1,7 +1,3 @@
-Note: Most test cases are not up to date to the current Nimrod

-version. Only ``thallo`` is frequently tested! The best test is

-to bootstrap, anyway.

-

 This directory contains the test cases.

 Each test must have a filename of the form: ``t*.nim``

 

diff --git a/tests/thallo.nim b/tests/thallo.nim
index 47d56724b..f8d3b8a69 100644
--- a/tests/thallo.nim
+++ b/tests/thallo.nim
@@ -1,7 +1,11 @@
 # Hallo
 
 import
-  os
+  os, strutils, macros
+
+type
+  TMyEnum = enum
+    meA, meB, meC, meD
 
 when isMainModule:
   {.hint: "this is the main file".}
@@ -9,7 +13,7 @@ when isMainModule:
 proc fac[T](x: T): T =
   # test recursive generic procs
   if x <= 1: return 1
-  else: return x * fac(x-1)
+  else: return x.`*`(fac(x-1))
 
 macro macrotest(n: expr): stmt =
   expectKind(n, nnkCall)
@@ -35,22 +39,41 @@ echo("This was compiled by Nimrod version " & system.nimrodVersion)
 writeln(stdout, "Hallo", " World", "!")
 
 echo(["a", "b", "c", "d"].len)
-for x in items(["What's", "your", "name", "?"]):
+for x in items(["What's", "your", "name", "?", ]):
   echo(x = x)
 var `name` = readLine(stdin)
 {.breakpoint.}
 echo("Hi " & thallo.name & "!\n")
 debug(name)
 
-var testseq: seq[string] = @[ "a", "b", "c", "d", "e"]
+var testseq: seq[string] = @[
+  "a", "b", "c", "d", "e"
+]
 echo(repr(testseq))
 
 var dummy = "hallo"
 echo(copy(dummy, 2, 3))
 
+echo($meC)
+
+# test tuples:
+for x, y in items([(1, 2), (3, 4), (6, 1), (5, 2)]):
+  echo x
+  echo y
+  
+# test constant evaluation: 
+const 
+  constEval = "abc".contains('b')
+  constEval2 = fac(7)
+
+echo(constEval)
+echo(constEval2)
+echo(1.`+`(2))
+
 for i in 2..6:
   for j in countdown(i+4, 2):
     echo(fac(i * j))
 
 when isMainModule:
   {.hint: "this is the main file".}
+
diff --git a/tests/titer.nim b/tests/titer.nim
index 3f71ba8d9..19a11dc4e 100644
--- a/tests/titer.nim
+++ b/tests/titer.nim
@@ -32,3 +32,13 @@ for i in xrange(0, 5):
 for j in interval(45, 45):

   write(stdout, "test2!")

   write(stdout, "test3?")

+

+for x in items(["hi", "what's", "your", "name"]):

+  echo(x)

+  

+const

+  stringArray = ["hi", "what's", "your", "name"]

+

+for i in 0..len(stringArray)-1:

+  echo(stringArray[i])

+

diff --git a/tests/tlibs.nim b/tests/tlibs.nim
index 317430744..2326fba64 100644
--- a/tests/tlibs.nim
+++ b/tests/tlibs.nim
@@ -1,9 +1,10 @@
 # Test wether the bindings at least compile...
 
 import
+  unicode,
   osproc, zipfiles,
   sdl, smpeg, sdl_gfx, sdl_net, sdl_mixer, sdl_ttf,
-  sdl_image, sdl_mixer_nosmpeg
+  sdl_image, sdl_mixer_nosmpeg,
   cursorfont, xatom, xf86vmode, xkb, xrandr, xshm, xvlib, keysym, xcms, xi,
   xkblib, xrender, xutil, x, xf86dga, xinerama, xlib, xresource, xv,
   gtk2, glib2, pango, gdk2,
diff --git a/tests/tnew.nim b/tests/tnew.nim
index 813bb9433..6527541a2 100644
--- a/tests/tnew.nim
+++ b/tests/tnew.nim
@@ -31,7 +31,7 @@ proc main() =
 

     n = newNode(i, nil, newNode(i + 10000, nil, nil))

     inc(i)

-  #new(p)

+  new(p)

 

   write(stdout, "Simple tree node allocation worked!\n")

   i = 0