summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2009-05-08 16:36:06 +0200
committerAndreas Rumpf <rumpf_a@web.de>2009-05-08 16:36:06 +0200
commitdb4f617afcd095db087dcb52e3ea603cca111da7 (patch)
treeeeffcc8fb523171dc394c136acf9b8006ec4138f /tests
parent08bc9ac03c49db7bfcdee82f46aadf95a324e015 (diff)
downloadNim-db4f617afcd095db087dcb52e3ea603cca111da7.tar.gz
version 0.7.8
Diffstat (limited to 'tests')
-rw-r--r--tests/csvtest.csv8
-rw-r--r--tests/data.csv6
-rw-r--r--tests/gctest.nim25
-rw-r--r--tests/toop1.nim2
4 files changed, 36 insertions, 5 deletions
diff --git a/tests/csvtest.csv b/tests/csvtest.csv
new file mode 100644
index 000000000..6e7e14103
--- /dev/null
+++ b/tests/csvtest.csv
@@ -0,0 +1,8 @@
+headerField1,headerField2,headerField3
+12,12132,"hallo ""
+ du"
+1,,
+,2,
+,,3
+1,2,3
+
diff --git a/tests/data.csv b/tests/data.csv
new file mode 100644
index 000000000..ea73f7387
--- /dev/null
+++ b/tests/data.csv
@@ -0,0 +1,6 @@
+Algo_A; Algo_B; Algo_C
+12; 12; 16
+2; 5; 9
+63; 65.3; 90
+0; 1.2; 3
+
diff --git a/tests/gctest.nim b/tests/gctest.nim
index 2f8b97b38..f58dc3217 100644
--- a/tests/gctest.nim
+++ b/tests/gctest.nim
@@ -28,6 +28,16 @@ type
     of nkList: sons: seq[PCaseNode]
     else: unused: seq[string]
 
+  TIdObj* = object of TObject

+    id*: int                  # unique id; use this for comparisons and not the pointers

+  

+  PIdObj* = ref TIdObj

+  PIdent* = ref TIdent

+  TIdent*{.acyclic.} = object of TIdObj

+    s*: string

+    next*: PIdent             # for hash-table chaining

+    h*: int                   # hash value of s

+
 var
   flip: int
 
@@ -134,7 +144,17 @@ proc buildBTree(father: var TBNode) =
     father.t.data = @["ha", "lets", "stress", "it"]
   setSons(father)
 
+proc getIdent(identifier: cstring, length: int, h: int): PIdent = 
+  new(result)

+  result.h = h

+  result.s = newString(length)
+
 proc main() =
+  discard getIdent("addr", 4, 0)
+  discard getIdent("hall", 4, 0)
+  discard getIdent("echo", 4, 0)
+  discard getIdent("huch", 4, 0)
+  
   var
     father: TBNode
   for i in 1..1_00:
@@ -156,9 +176,6 @@ proc main() =
   writeln(stdout, s[89])
   write(stdout, "done!\n")
 
-#main()
-
-#GC_disable()
 var
     father: TBNode
     s: string
@@ -177,4 +194,4 @@ main()
 write(stdout, "finished\n")
 GC_fullCollect()
 GC_fullCollect()
-write(stdout, GC_getStatistics())
+writeln(stdout, GC_getStatistics())
diff --git a/tests/toop1.nim b/tests/toop1.nim
index bf3d2021d..8bae002e7 100644
--- a/tests/toop1.nim
+++ b/tests/toop1.nim
@@ -31,7 +31,7 @@ proc init(my: var TRectangle) =
   my.height = 10
   my.draw = drawRectangle
 
-macro `!` (n: expr): expr = 
+macro `!` (n: expr): stmt = 
   result = newNimNode(nnkCall, n)
   var dot = newNimNode(nnkDotExpr, n)
   dot.add(n[1])    # obj