diff options
author | Araq <rumpf_a@web.de> | 2015-05-02 07:59:13 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-05-03 01:08:48 +0200 |
commit | 7d3a6b42d9deb8eef0ee0f50ba3bee2476502a4f (patch) | |
tree | 7ca0a10db930795226ef440b900748f4383aa668 /tests/collections | |
parent | fe268b7df7f6b8f7dbfc7eba9c159c6bca769520 (diff) | |
download | Nim-7d3a6b42d9deb8eef0ee0f50ba3bee2476502a4f.tar.gz |
fixes #2625
Diffstat (limited to 'tests/collections')
-rw-r--r-- | tests/collections/tcounttable.nim | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/collections/tcounttable.nim b/tests/collections/tcounttable.nim new file mode 100644 index 000000000..ebbb1c8e5 --- /dev/null +++ b/tests/collections/tcounttable.nim @@ -0,0 +1,19 @@ +discard """ + output: "And we get here" +""" + +# bug #2625 + +const s_len = 32 + +import tables +var substr_counts: CountTable[string] = initCountTable[string]() +var my_string = "Hello, this is sadly broken for strings over 64 characters. Note that it *does* appear to work for short strings." +for i in 0..(my_string.len - s_len): + let s = my_string[i..i+s_len-1] + substr_counts[s] = 1 + # substr_counts[s] = substr_counts[s] + 1 # Also breaks, + 2 as well, etc. + # substr_counts.inc(s) # This works + #echo "Iteration ", i + +echo "And we get here" |