summary refs log tree commit diff stats
path: root/tests/vm
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-09-17 10:42:07 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-09-17 15:15:12 +0200
commitc9f3a8b269ffbe52ee843ba350faf569d99e8106 (patch)
tree7b95fe20fcf2357286970bd5beb817056827ec99 /tests/vm
parentf1b7c0494edbe8e2a6c6eb4764354bbfd6703bf1 (diff)
downloadNim-c9f3a8b269ffbe52ee843ba350faf569d99e8106.tar.gz
added a testcase for #12195; testament now supports a 'timeout' spec field
Diffstat (limited to 'tests/vm')
-rw-r--r--tests/vm/tslow_tables.nim31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/vm/tslow_tables.nim b/tests/vm/tslow_tables.nim
new file mode 100644
index 000000000..7ee523a87
--- /dev/null
+++ b/tests/vm/tslow_tables.nim
@@ -0,0 +1,31 @@
+discard """
+  timeout: "4"
+  action: "compile"
+  nimout: '''create
+search
+done'''
+"""
+
+# bug #12195
+
+import tables
+
+type Flop = object
+  a: int
+  #array[128, int]  # <-- compile time is proportional to array size
+
+proc hop(): bool =
+  var v: Table[int, Flop]
+
+  echo "create"
+  for i in 1..1000:
+    v.add i, Flop()
+
+  echo "search"
+  for i in 1..1000:
+    discard contains(v, i)
+
+  echo "done"
+
+const r = hop()
+