summary refs log tree commit diff stats
path: root/tests/generics
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-03-10 22:23:38 +0100
committerAraq <rumpf_a@web.de>2014-03-10 22:23:38 +0100
commit3270676e77676335446287fcff05aa6a6b9b4919 (patch)
tree4bd724bed5ae887efa9d8f97494755715980ca20 /tests/generics
parent121553d1a69c4d175259944f6bdc9f9dcfda9cdd (diff)
parent1546d210c5739213ebf93eb0cb624ca7a9fe9ad6 (diff)
downloadNim-3270676e77676335446287fcff05aa6a6b9b4919.tar.gz
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Diffstat (limited to 'tests/generics')
-rw-r--r--tests/generics/tgenericshardcases.nim18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/generics/tgenericshardcases.nim b/tests/generics/tgenericshardcases.nim
index 2ef63bc20..e3b805db6 100644
--- a/tests/generics/tgenericshardcases.nim
+++ b/tests/generics/tgenericshardcases.nim
@@ -14,7 +14,8 @@ macro selectType(a, b: typedesc): typedesc =
 type
   Foo[T] = object
     data1: array[T.high, int]
-    data2: array[typeNameLen(T), float] # data3: array[0..T.typeNameLen, selectType(float, int)]
+    data2: array[typeNameLen(T), float]
+    data3: array[0..T.typeNameLen, selectType(float, int)]
 
   MyEnum = enum A, B, C, D
 
@@ -27,10 +28,15 @@ echo high(f1.data2) # (MyEnum.len = 6) - 1 == 5
 echo high(f2.data1) # 127 - 1 == 126
 echo high(f2.data2) # int8.len - 1 == 3
 
-#static:
-# assert high(f1.data1) == ord(D)
-# assert high(f1.data2) == 6 # length of MyEnum
+static:
+  assert high(f1.data1) == ord(C)
+  assert high(f1.data2) == 5 # length of MyEnum minus one, because we used T.high
 
-# assert high(f2.data1) == 127
-# assert high(f2.data2) == 4 # length of int8
+  assert high(f2.data1) == 126
+  assert high(f2.data2) == 3 
+
+  assert high(f1.data3) == 6 # length of MyEnum
+  assert high(f2.data3) == 4 # length of int8
+
+  assert f2.data3[0] is float