summary refs log tree commit diff stats
path: root/tests/vm/triangle_array.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-12-28 00:42:24 +0100
committerAraq <rumpf_a@web.de>2014-12-28 00:42:24 +0100
commit41587a533959e4269be29f4f238d524048ac303a (patch)
tree30c53323f16acb2cb0599a0b999f4aaf63ea105a /tests/vm/triangle_array.nim
parent010b8f85c73671782de956c9dcd2cb3e8441041e (diff)
downloadNim-41587a533959e4269be29f4f238d524048ac303a.tar.gz
fixes #1781
Diffstat (limited to 'tests/vm/triangle_array.nim')
-rw-r--r--tests/vm/triangle_array.nim17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/vm/triangle_array.nim b/tests/vm/triangle_array.nim
new file mode 100644
index 000000000..054c66f22
--- /dev/null
+++ b/tests/vm/triangle_array.nim
@@ -0,0 +1,17 @@
+discard """
+  output: "56"
+"""
+
+# bug #1781
+
+proc initCombinations: array[11, array[11, int]] =
+  result[0]          = [1,2,3,4,5,6,7,8,9,10,11]
+  result[1][1 .. 10] =   [12,13,14,15,16,17,18,19,20,21]
+  result[2][2 .. 10] =     [22,23,24,25,26,27,28,29,30]
+  result[3][3 .. 10] =       [31,32,33,34,35,36,37,38]
+  result[4][4 .. 10] =         [39,40,41,42,43,44,45]
+  result[5][5 .. 10] =           [46,47,48,49,50,51]
+  result[6][6 .. 10] =             [52,53,54,55,56]
+
+const combinations = initCombinations()
+echo combinations[6][10]